how to restart Cordova app after it is killed - android

I am using a plugin for background service in my android cordova app
https://github.com/katzer/cordova-plugin-background-mode
but my app seems to crash/freeze or killed after 5-6 hours, is there any way i can restart my application after it is killed ?

Finally I have a workaround .. The app stops in the background when the Phone goes to sleep .. so I had to make sure, the phone doesn't go to sleep ..
So i used power management plugin together with Background mode plugin.. and it works well..

Related

How can i prevent my app stopped when phone Reboot in flutter?

I was working on flutter app and my app mainly works in background so , what I want is to run my app continuously without stopping when the phone is rebooted, or at any means my app should run in background forever.
so, is there any mechanism in flutter to do This?
this can only be done on Android side on IOS when user closes the app its process will be killed shortly after (we are talking seconds or minutes).
on Android you can achieve this by using a ForegroundService plugin like android_long_task

How restart android app after unlock screen

I have a react native app that use paho mqtt (react native module) the problem is that when the screen is lock, this service die. Im not android developer but I read that the problem is that doze mode kill all and my paho service die after a few minutes.
I read this issue https://github.com/eclipse/paho.mqtt.android/issues/226 and test a solution given there but in android > 8 this solution not work anymore.
I think 2 possible solutions:
1. Run service again after unlock the screen (dunno how to do this for
android >8).
2. Restart the app after unlock the screen (Searching for how detect that the screen is unlock in react native).
If someone know how to handle this solutions or another one.
For Android native, you can use Service
A service is simply a component that can run in the background, even when the user is not interacting with your application, so you should create a service only if that is what you need.
I know you are using react-native, but hope the info would provide some hints.

How to build an IONIC 3 app runs as a 'foreground service'?

I am converting one of my own app written in Java with Android SDK to a new one based on IONIC 3. My old app starts automatically after phone boots up and runs as a foreground service.
I can see that there is an 'autostart' plugin in IONIC Native that I can use to start my app automatically after phone reboot (https://ionicframework.com/docs/native/autostart/)
However, I cannot see any plugin to let my app runs as a 'foreground service'.
I need to keep my app running as a foreground service so that it can monitor some physical button actions.
You can use Background Mode plugin after using autostart. This plugin prevents going to a pause state when in background, so that way you can still execute anything in your app (like it was in foreground).
I don't know where in your app do you monitor the button pressed, if it's in a specific view, but in Ionic probably you'll need to monitor it on app.components.ts.
Hope this helps

Combination of Android service, Cordova background plugin and Skype O365 sdk does not working after few hours while running in background?

I am working on ionic platform and making one Android and iOS application.
Application requirement:
Skype for business O365 login will be there for user and then minimizing the application it will change the status of user like busy, available and note as well on regular interval.
What I have done:
I have used Cordova background mode and Skype websdk.It's logging in fine and setting the status fine while using in foreground.
Problem I am facing:
If I put application in background mode then the status is setting for few minutes but after that somehow it's not setting the status.
So, I am thinking that might be some scenarios:
Might the Android or iOS stopping the background service.
Might the cordova background plugin not working properly.
Might the Skype websdk stops after some time while running in background
Getting this error after the 404 not found code.
https://webpooldb41e02.infra.lync.com/ucwa/oauth/v1/applications/1145363530/me/reportMyActivity
I am researching for the above aspects as well.
I had a same problem. Its not about Background plugin. I found that Skype SDK somehow stops working if it stays in same network for more then around 4800 seconds.
What I did is I signed out and signed Back In user with SetInterval. So token will refreshed and It worked for me. You can use signet and signIn with setInterval of 4000 second or so.

cordova background geolocation on terminated app

I am trying to work out if this is even possible.
Using Cordova I have an app requirement that will alert the user once they are in a certain location.
This needs to happen even after the app has been terminated (not in springboard).
I know you can do it when the app is running and while in background mode but is it possible once the app has been terminated?
Using the cordova-plugin-background-geolocation will handle the background work but not sure how it works when the app is no longer running.
using cordova 3.5

Categories

Resources