Iam trying to do some functionality when app is suspended i used
it works perfectly when app is running, when killed the app is stop working. Then,I used https://github.com/katzer/cordova-plugin-local-notifications/
it make a notification when app is killed but i can’t handle any of it’s events unless app is running , Does anyone try to do like an ajax call when app is killed after period of time ? Is there any other repos make a background service while app isn’t running ?
Thanks for replying,
yes … it works when app is still exist , if i kill it it won’t work any more .
if you try to do this for notifications
don’t use local notifications
instead use push notifications
let’s assume that i need to do ajax call every 2 hours , how can i do it if the app isn’t running ?
you can do it server side and push notifications
i will give a try, but iam thinking of background process like in android , does ionic has any thing similar ?
what the cordova background mode is do
when the app go to background its start play media in the background
so is like he full the device that he have process in the background
i read that app store don’t accept the app if you use this plugin (i didn’t checked)
also in android you will have a notification that something is in the background
and i don’t really like it.
you can try to write yourself a service with
the most important thing i can say that if the user don’t want the app in the background let the user
the option, don’t force the app on the users if it was me i will uninstall it.
so if it is only notifications use push from server side
the user will get it also if the app is killed
I am writing a sunrise and sunset app. The app is to fire audio alerts when the sun rises and sets.
I got the whole thing sorted out under Android thanks to the following 2 plugins:
First one takes care of the background service, second one does the magic of launching/resurrecting the app from nowhere at startApp. really sweet. But…
These plugins are useless for the ios World.
Background services has very strict guidelines. I’ve communicated with the app review team at apple and they told me each app is unique and they need to look into when I send them the app.
Assuming they will reject the use of the famous plug in “de.appplant.cordova.plugin.background-mode”, I decided to develop a Plan-B but I got no objective C/switch exp. & my tool set is limited to JS/Angular what the cordova plugins can do for me basically,
If I were to pull this off with the local Notifications, then I can only schedule upto 64.
That means, in 64/2=32 days, the app will stop its alerts. Plus the local notifications does have its own visual UI which gets in the way in my opinion so I prefer avoiding them. My app just needs to play a small notification alert, it does not need UI which comes with the local Notif.
As I said, as to the android, I can just keep running it until the user stops the app from running.
I’m banging my head around this for the ios.
What say you?
Did you try to use cordova-plugin-background-app (https://www.npmjs.com/package/cordova-plugin-background-app)?
The purpose of this plugin is to enable notifications, alarms, etc to re-start your app and fire callbacks without the app causing any visual cues to the user. In essense, it allows starting an app as an Android service, but does so without the use of …
nope , it sounds interesting … i will give a try
alexandrealrocha, how could we use it together typescript/ionic 2?
Hello, sorry but this plugin doesn’t work as I wish. So I uninstalled it from my app and still with this question opened.
If you know something new about it, please let me know.
Hey man! try this!
try this one also.
Does anyone make a working demo on that topic before ?
Do not use this plugin
Because apple app store reject app due to this plugin
I know there was no thing in apple apps, iam talking about the android one
but in android this plugin work horribly android device giving notification about it
I am developing an application(for iOS) where I need to update my device location at the server side. I tried to use web socket to send device location. It work’s fine when the application is in foreground mode. But it does not work when the application goes to background mode. I need to send my device location at application background mode also. Can ‘Cordova-plugin-background-app’ this plugin will help in my case. I tried solutions at the xCode side, changes in ‘Backgound Modes’ in Capabilities, but nothing so helpful.