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.
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?
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?
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…)
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.
Well, in fact that is what ECPN does! It receives the push notification (or GCM message in Google) and produces a local notification You could of course send a message to self and get it no matter what
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.
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?
@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.