Stencyl 3.4.0 is now out. Get it now!

[IOS/Android] Local Notifications [v2.5.2]

robinschaafsma

  • *
  • Posts: 647
Local Notifications
Works on iOS, Android

This extension enabled local notificaton in your game.

IMPORTANT
This Extension Required the Toolset Extension Manager http://byrobin.nl/store/product/byrobintoolsetextension/


Features
- works on IOS and android
- retpeat notification

How to download this extension
Go to: http://byrobin.nl/store/product/local-notifications-for-ios-android-stencylopenfl
Add the extension to the cart en proceed with checkout. After you successfully placed the order, you will get an e-mail with the download link or go to “My Account” section where you can also find the download link.

Install the zip file: Go to : http://community.stencyl.com/index.php/topic,30432.0.html

Blocks
- Schedule new local notification with repeat.
- Cancel all notifications
- Set icon badge number to
- Increase icon badge number by
- Decrease icon badge number by

Version History
-2.0 release 2015-07-23
-2.1 2015-07-24 : BUG FIX On Android when game is force to closed by player, repeat notification does not work. Works only on background. and it works now on < iOS 8  (thanks mdotedot).
-2.2 2015-07-26 : On Android when game is created first time Badge number wil set to 0. -  Add icon on blocks.
-2.3 2015-07-31 : Now download via GitHub
-2.4 2015-08-05 : Comments the assets path in include.xml, assets folder is not needed.
-2.5 2015-10-09 : Android Updated android-support-v4.jar to get it work with Stencyl build b9186 and higher
2017-05-16(2.5.1) Tested for Stencyl 3.5, Required byRobin Toolset Extension Manager
2017-05-18(2.5.2): FIX: iOS when selelect no repeat, notification not showing. FIX: single/double quotes does not accepted.


« Last Edit: May 18, 2017, 01:58:19 am by robinschaafsma »
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



robinschaafsma

  • *
  • Posts: 647
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



This is great! Thank you so much!

GameDev408

  • *
  • Posts: 211
This is a great extension!

mdotedot

  • *
  • Posts: 1260
Hi Robin,

Very Cool!

As you mentioned it doesn't work when app is closed on Android.

Do I have your permission to modify the code a bit and try to see if I can let it work with my server?!

Thanks a lot for your work! Appreciated!

Best regards from
M.E.
Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

robinschaafsma

  • *
  • Posts: 647
Hi Robin,

Very Cool!

As you mentioned it doesn't work when app is closed on Android.

Do I have your permission to modify the code a bit and try to see if I can let it work with my server?!

Thanks a lot for your work! Appreciated!

Best regards from
M.E.


Yes you have, if you have a solution, let me know.
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



mdotedot

  • *
  • Posts: 1260

Hallo Robin,


In NCReceiver you try to access Extension.mainActivity .. it is null!
Code: [Select]

//        Intent notificationIntent = new Intent(context, Extension.mainActivity.getClass());

//        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);


Replace above with this:

Code: [Select]

        PendingIntent contentIntent= PendingIntent.getActivity(context.getApplicationContext(), 0, new Intent(), 0);


So we create a new Intent.

Rest works fine!

For the iOS I needed to change something as well to make it work on < iOS 8 … Everything works nicely on iOS 8.1.2 but failed on my older devices.

Code: [Select]
// [self setNotificationTypesAllowed];


And to let the <ios8 do actually something I assume allowNotif so I commented out those things:
Code: [Select]
    //if (allowNotif)

    //{


//}



So now I can try to connect to my server and display messages that I need to say to the user.

On Android/Java I think I can manage to not raise the notification but keep it repeating.
Do you have a trick I could use to do the same in iOS?
What I want is to check on notification for something on a server and depending on
the result raise the actual notification or omit the notification and check the server in the repeated - setting.

Best regards/
Vriendelijke groet!

M.E.
Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

robinschaafsma

  • *
  • Posts: 647
Hi M.E.

Thanks a lot for your solutions, i have updated the extension.

Quote
On Android/Java I think I can manage to not raise the notification but keep it repeating.
Do you have a trick I could use to do the same in iOS?
What I want is to check on notification for something on a server and depending on
the result raise the actual notification or omit the notification and check the server in the repeated - setting.

No, sorry don't know a trick for that.
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



mdotedot

  • *
  • Posts: 1260

Hoi Robin,


The AndroidManifest.xml contains SMS permission.
Why did you turn that on?
I've removed the permission and the app seems to work fine without it.
Code: [Select]
  <uses-permission android:name="android.permission.SEND_SMS"/>


I played a little with private subclassing your NCReceiver to make the notification fire when a reponse is received from an online server. 
That appears to work in my test situation for Android. I'm about to test/play with iOS to do the same.

Do you mind if I made a new extension based of your work? I want to notify gamers with invites from other players to join a game or send gamers other information from my server!


Best regards from
M.E.
Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

robinschaafsma

  • *
  • Posts: 647
Quote
The AndroidManifest.xml contains SMS permission.
Why did you turn that on?

I tested notification with SMS, forgot to delete it.

Quote
Do you mind if I made a new extension based of your work? I want to notify gamers with invites from other players to join a game or send gamers other information from my server!

Do you mean like Push notification extension?
Than you can make a Push notification extension based of my work. But make it for Android and IOS.
I have a lot of work at it.
If this extension works good, maybe we wanna build it in Stencyl.
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



mdotedot

  • *
  • Posts: 1260
Remote / Push notification was not exactly what I was going for.
From what I've seen the mechanism would involve a lot of tweaks to get right.

What I've discovered so far is that iOS doesn't really allow background applications to become active easily.
There are some things that I'm exploring but it isn't as easy as Android was. What Apple seems to want you to do is to go for remote notification.

I don't actually understand what you said about a ' lot of work at it'

Wat bedoel je precies? Heb je er al veel tijd ingestoken of was je van plan er tijd in te stoppen?

Best regards from
Vriendelijke groet,
M.E.

Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

robinschaafsma

  • *
  • Posts: 647
Quote
Wat bedoel je precies? Heb je er al veel tijd ingestoken of was je van plan er tijd in te stoppen?

I just see now, you are dutch also, sorry for my bad english :)

Ik bedoel dat ik er veel tijd in de extension heb gestoken, en daarom dat je op basis van mijn werk een nieuwe extension mag maken.

iOS have lots of roles, i think what you wanna do, only possible with Push Notificaton or Game Center Multiplayer methode. But i am not sure.

Best regards from
Vriendelijke groet,
Robin.
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



robinschaafsma

  • *
  • Posts: 647
UPDATE 2.3
-Download from GitHub

See the first post, you have to download it from GitHub now.

If you already install a previous version 2.2 or below,  follow the instruction on this page how to update the extension https://github.com/byrobingames/localnotifications/blob/master/README.md#how-to-install
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl



designpeg

  • *
  • Posts: 519
I get the following error

[openfl] Error: Could not find asset path /STENCYL_DEVELOPMENT/stencylworks/engine-extensions/localnotifications/assets/"

robinschaafsma

  • *
  • Posts: 647
I get the following error

[openfl] Error: Could not find asset path /STENCYL_DEVELOPMENT/stencylworks/engine-extensions/localnotifications/assets/"

Oops, can you download version 2.4 from github and reinstall the extension. let me know when this resolved the problem
byRobinGames.com


I'am not always on the forum, you can mail me if you have an question. info@byrobin.nl