Easy Local Android Notifications

1288949--58903--$small_android1.png

Hi All!

I would like to present you my new package: Easy Local Android Notifications.

Have you ever wondered whether you can have native local notification services for android? Now you can! With Easy Local Android Notifications you can:

  • Fire single notifications
  • Schedule repeating notifications
  • Cancel any delayed notifications

Whether you want to remind your users to come back to your app or send them a single message about some event that happened when they were away, ELAN is an easy solution to send messages to the notifications bar.

ELAN is the android equivalent of the built in NotificationServices for iOS.

Let me know what you think about it.

Enjoy and happy coding!

1288949--58902--$icon_androidbitmap.png

Just adding a nice pic to make it all more visual :slight_smile:

It seems “ELANManager.SendNotification” is called in “OnApplicationPause”, whenever suspend.
Seeing log, I can see “am_create_activity” was called but “am_finish_activity” is not working.

It working well, without when I call it in suspend.

Could you tell me how we can resolve this problem?

Hi sugi,

I’m not sure I understand what the issue is. The plugin has no calls OnApplicationPause method, so it should not be called when your app suspends! Could you send me the logs you are referring to so I can see what is going on?

Also, how do you know the method SendNotification is being called there? Do you get a notification when you suspend (i.e. exit with the home button) the scene?

Thank you for your quick response!
I’m sorry for expression was not clear.

Make what I want to do clear.
I want set the Local Notification when user suspend the application,
sutch as touch the home button.

So, I use “SendNotification” in “OnApplicationPause”.

Here is the log,

07-17 19:09:54.717: I/ActivityManager(539): START {flg=0x10000000 cmp=jp.co.NotificationTest/com.CFM.ELAN.ELANAlarmCreator (has extras) u=0} from pid 17748
07-17 19:09:59.497: I/REC@0(539): am_create_activity: {1140868104,27,jp.co.NotificationTest/com.CFM.ELAN.ELANAlarmCreator,null,null,null,272629760}

It is not work well, because stop befor “am_finish_activity”.
Thanks.

OK, I think I know what’s going on.

You are right, if you call ELANManager.SendNotification() within OnApplicationPause it will stop before it actually sends the notification -however once you resume your app the notification will appear in the notification bar. This is a consequence of how android works: if the user suspends an app, any activity deriving from that app is suspended -including ELAN.

According to Unity documentation you can use OnApplicationPause as a Co-routine, which could mean there is a way to stop the “suspend” process for long enough to send the notification, but I have not managed to make it work -it seems unity calls OnApplicationPause really when the app has been paused and not when it is being paused.

That being said, maybe you can manage a workaround using ELANManager.ScheduleRepeatingNotification() or with ELANManager.SendNotification(delay) -both of them will deliver the message, no matter the state of your app (paused, killed…)

If I reboot the phone, will future notification be killed too?

If a user does reboot the phone, the future notification unfortunately won’t reach its destination -pretty extreme use case though!

Rebooting will also kill any repetitive notifications your app has set.

I reboot my phone quite often, unfortunately. How does WhatsApp, Line do it? Maybe you can combine withe the server notification package to initiate the local packages back?

WhatsApp and Line are closer to what I offer in ECPN: a system to deliver remote notifications to self or to other users of your app.

This package is a simplification of that for the use case of some app wanting to deliver messages locally to your user -for those developers that do not have or do not want to have the server side set up.

I have both. I’m just thinking of getting your package can cooperate by having the server to activate the local notification.

Well, in fact that is what ECPN does! It receives the push notification (or GCM message in Google) and produces a local notification :slight_smile: You could of course send a message to self and get it no matter what

Screen is Black-out(1sec) to Function call in ELANManager.
How Can i fix?

Well, not much you can do there, as this is a consequence of the plugin being an activity in Java. I will try to minimize the impact if I can.

I think you misunderstood me. I mean, my app would have code to fire the local notification, but if I use ECPN, then I need server side logic to fire. What I’m thinking is like a ping alive from the server, which talks to the local instead of both firing if app is active.

I am also in trouble.
When will it be fixed?

@sugi @DaeRo: I’ve been working on that issue and I can confirm it has been solved! I just submitted an update to the asset store with the fix.

Cheers.

A quick question: Does this plugin only allow for sending (local) notifications or does it also register the app for handling the notifications?

In other words, would it be possible to schedule a notification (in for example 2 hours) and then (when the user already did leave the app) actually fire up the unity application again when the notification is clicked?

Thanks in advance!

Cheers.

@GerryM: yeah, the plugin was indeed designed with that particular functionality in mind!

You can schedule your notifications with any delay you choose fit and after that time you will see it on the notifications bar -and clicking on it will load your app.

Terrific! Thanks!

Just bought it. Really a bargain. Was fumbling around with this functionally way too long…

Keep up the good work :sunglasses: