It’s finally here, the plugin for our Cocos Helper allowing you to use Notifications.
ATM the Helper has iOS C++ and JavaScript local notifications with Android coming soon.
Firstly setup Cocos Helper using one of the following links:
Once your setup, using push notification is ridiculously easy with just a single line of code
C++
SonarCocosHelper::Notifications::scheduleLocalNotification( delay, text to display );
e.g.
SonarCocosHelper::Notifications::scheduleLocalNotification( 5.0, “You now have a new life” );
JavaScript
SonarCocosHelper.Notifications.scheduleLocalNotification( delay, text to display );
e.g.
SonarCocosHelper.Notifications.scheduleLocalNotification( 5.0, “You now have a new life” );
Delay - is how long after the local notification is shown
Text to display - the text that the notification displays to the user
3 Likes
I didn’t use your tutorial still, but I have a suggestion…
It would be essential feature that I can unschedule or reschedule a notification. In android you give any notification a key for this purpose.
Hope for a comprehensive Notification System Tutorial from you soon
Thank you for your feedback.
Would it be possible to get support for hooking into when the application is launched/foregrounded by touching a notification? Perhaps even allowing us to provide associated user data for a notification.
Also push notification support?
Notification system has now been updated to supported unscheduling and notification repeating along with a custom lock screen slide message.
Could you explain this in more depth as we don’t quite understand what you are asking for.
Push notification is also coming
OK, the current notification system has all of that apart from userdata on the notification as the delay parameter allows notifications to be called x amount of time in the future. userdata sounds really cool. I will start working on it immediately.
1 Like
Hy @almax27 did you achieve this thing ?
We are still working on it.
What about Android support? @SonarSystems
@SonarSystems is this open-sourced? i think, we should get helps from all…
for cocos2d-x(c++) & android
I used below code in AppDelegate.cpp
void AppDelegate::applicationDidEnterBackground() {
SonarCocosHelper::Notifications::scheduleLocalNotification(0,"test","now",1234);
Director::getInstance()->stopAnimation();
}
but in my android phone, noting was happened
so, i checked your SonarFrameworks.cpp
void Notifications::scheduleLocalNotification( float delay, cocos2d::__String textToDisplay, cocos2d::__String notificationTitle, cocos2d::__String notificationAction , int notificationTag )
{
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#elif(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if SCH_IS_NOTIFICATIONS_ENABLED == true
IOSCPPHelper::scheduleLocalNotification( delay, textToDisplay, notificationTitle, notificationAction ,notificationTag);
#endif
#endif
}
Where is code for android platform??
is it work without any code? or something i misunderstood??
Android support isn’t available ATM.