Show Local Notification If App Is Idle For Some Time

Hello

I made an App using Corona and now I want to show Local notifications in it. Well showing notification seems fairly simple but I need help on a specific case. Actually I want to show local notification if user is not using the App for some time like a week. I need help on this that how can I detect that user is not using the App.

Will be thankful for help

This code will let you see the status of the app if it has opened or closed. 

local onSystem = function( event )     if event.type == "applicationStart" then         print("start")     elseif event.type == "applicationExit" then         print("exit")     elseif event.type == "applicationSuspend" then         print("suspend")     elseif event.type == "applicationResume" then         print("resume")     end end -- setup a system event listener Runtime:addEventListener( "system", onSystem )

You will need to set your local notification on app exit, and cancel it on application start. Also when app starts, you can take in the OS time and calculate 1 week from that date that you can pass into the app exit logic. 

Hope this helps :slight_smile:

Thanks…

It was helpful :slight_smile:

This code will let you see the status of the app if it has opened or closed. 

local onSystem = function( event )     if event.type == "applicationStart" then         print("start")     elseif event.type == "applicationExit" then         print("exit")     elseif event.type == "applicationSuspend" then         print("suspend")     elseif event.type == "applicationResume" then         print("resume")     end end -- setup a system event listener Runtime:addEventListener( "system", onSystem )

You will need to set your local notification on app exit, and cancel it on application start. Also when app starts, you can take in the OS time and calculate 1 week from that date that you can pass into the app exit logic. 

Hope this helps :slight_smile:

Thanks…

It was helpful :slight_smile: