local notifications question

Hi all,

I’m doing a project that involves a person to select a date and it will notificate him at that time. he can have multiple different notifications. basically a reminder system. Since Android local notification system depends on app not beeing terminated, will I beeing able to do this task with success? the notifications can have 1 year interval, and the app could easy not been open in months since it’s not an every day use app. There are too many ways to terminate apps on Android, and I guess this project while is doable on theory in practice will fail most of the times. I’m thinking it wrong? anyone done this kinda of app with success?

regards,

Carlos.

I have not looked at notifications support in Corona in ages, but I did find this:

https://developer.android.com/reference/android/app/AlarmManager.html

It states that the alarm API will fire your code off even if your app is not running.

Of course, I can’t say that that is how CoronaLabs have implemented the API for us, but I’m fingers crossed.

@horacebury, not running, doesn’t mean it’s closed. by default android doesn’t close the apps. so they are running in background, even if you doesn’t see them in your background tab windows.

Android Unlike iOS, local notifications on Android are managed by the application and not by the operating system. This means that all scheduled notifications and status bar notifications will be cleared when the application process terminates. However, pressing the Back key to exit the application window will not terminate the application process — this only destroys the application window which runs your project's Lua scripts and it will receive the "applicationExit" system event just before being destroyed. Thus, the application process will continue to run in the background — this is standard Android application behavior which allows its notifications to remain available. If the application process gets fully terminated, Corona will automatically restore all pending notifications when the application restarts. This said, calling os.exit() will terminate the application process and clear all notifications. If you need to close just the application window, call native.requestExit() which only exits the application window and keeps the application process alive, thus keeping your notifications alive.

my point, is there are many apps out there that “really closes” not used apps for a long time, my htc have that by default on is OS. or other apps with memory manager that will close them. if the app is terminated, local notifications will not work if I understood right about local notifications. in that case, local notifications are useless in android for long time notifications or i’m missing some point?

I just made some tests with my app regarding with local notifications.

In IOS it passed with flying colors. I just made the upgrade to 10.3.2 and the notification still happened (i created before the upgrade). I used some “memory cleaner” programs also, and it still showed all my notifications.

On Android, it’s another story. It passed on reboot and normal closing. It passed on some “memory cleaner” programs, but it failed on some that terminate the processes (like I suspected). Don’t know how it will act on android updates since I don’t have any to test them. I guess I will have to warn the users on a note when creating the notifications, that this can happen if they use “cleaners” apps. if anyone has more info about this regard, please let me know.

regards,

Carlos.

I have not looked at notifications support in Corona in ages, but I did find this:

https://developer.android.com/reference/android/app/AlarmManager.html

It states that the alarm API will fire your code off even if your app is not running.

Of course, I can’t say that that is how CoronaLabs have implemented the API for us, but I’m fingers crossed.

@horacebury, not running, doesn’t mean it’s closed. by default android doesn’t close the apps. so they are running in background, even if you doesn’t see them in your background tab windows.

Android Unlike iOS, local notifications on Android are managed by the application and not by the operating system. This means that all scheduled notifications and status bar notifications will be cleared when the application process terminates. However, pressing the Back key to exit the application window will not terminate the application process — this only destroys the application window which runs your project's Lua scripts and it will receive the "applicationExit" system event just before being destroyed. Thus, the application process will continue to run in the background — this is standard Android application behavior which allows its notifications to remain available. If the application process gets fully terminated, Corona will automatically restore all pending notifications when the application restarts. This said, calling os.exit() will terminate the application process and clear all notifications. If you need to close just the application window, call native.requestExit() which only exits the application window and keeps the application process alive, thus keeping your notifications alive.

my point, is there are many apps out there that “really closes” not used apps for a long time, my htc have that by default on is OS. or other apps with memory manager that will close them. if the app is terminated, local notifications will not work if I understood right about local notifications. in that case, local notifications are useless in android for long time notifications or i’m missing some point?

I just made some tests with my app regarding with local notifications.

In IOS it passed with flying colors. I just made the upgrade to 10.3.2 and the notification still happened (i created before the upgrade). I used some “memory cleaner” programs also, and it still showed all my notifications.

On Android, it’s another story. It passed on reboot and normal closing. It passed on some “memory cleaner” programs, but it failed on some that terminate the processes (like I suspected). Don’t know how it will act on android updates since I don’t have any to test them. I guess I will have to warn the users on a note when creating the notifications, that this can happen if they use “cleaners” apps. if anyone has more info about this regard, please let me know.

regards,

Carlos.