I have developed a react-native app for Android to receive real time food orders (like Uber Eats, Postmates, etc.). The app is running in a Lenovo tablet that is constantly charging. I use a GraphQL subscription to detect new orders and Firebase Cloud Notifications to check the network status of the tablet.
The problem is that right now the system eventually kills the app after some days with no interaction. I would like to know the best approach to prevent the systems kills the app and being able to run it 24/7 in this case scenario.
Thanks!
You should write a service for your app, which starts the app when it gets killed.Never ending service has a good tutorial on how to do this.
Related
I have developed a hybrid app running on Android, that successfully monitors the users location and displays it to the user as a moving icon on a map. This part of the app is all written in javascript and works inside a webview. The webview also communicates with my remote server to share the user's location with other users of the same app.
Up until Android Nougat this all works even when the app is backgrounded for several days. When the user returns to the app they can see where they have been with timestamps at each point. And all the other app users can see where everyone is, even if they are no actively using the app.
From Android Oreo onwards, I had to move the location tracking to a background service to get it to continue in the background and I have tested this to be still working fine even with the app in the background for a long period. Returning to the app, the user can still see where they have been. However the remote communications to the server, on Android Oreo and later, cease after approximately 2 minutes in the background.
Please could someone explain why this is, and what I could (if anything) do about it?
What is the restriction that I am running into and where is it documented on Android developer? I have set the app as not to be limited in settings/network/data saver and this makes no difference.
Would it make a difference if I replaced the webview XMLHttpRequest with similar code in background service, using volley or something similar?
All help very much appreciated.
Although I have not discovered what restriction I am running foul of, I have found that by moving the http request from the web view to the background service using volley, the server continues to be updated whether or not the application is in the foreground.
Only tested so far on Android 8,9 and 10 in the emulator. Testing soon on a real device
We're currently running tests (that end in 2 weeks) with clients using an "older" version of our app.
The older app has a long-running scanner foreground service that will not restart on the MY_PACKAGE_UPDATE broadcast (wasn't implemented at the time). The new version of the app correctly handles this broadcast and restarts the scanning on MY_PACKAGE_UPDATE.
We need to roll out updates mid-test to fix a bug appearing on only some devices, and we are able to reach out to those specific users. The problem is that for any current users with auto-update turned on, their foreground scanning service will exit and not restart.
Am I correct that the MY_PACKAGE_UPDATE broadcast won't kick in yet? As in, it'll only begin working two updates from now?
Is there a way for me to turn off auto-updating for my app in the play store for all users?
I'm releasing a single app purpose that I update through google play store.
For those who do not know, a single app purpose is an app that is supposed to run alone on a device.
Therefore I give away the device the app, and prevent the users to use any other apps.
Anyway, I start the app automatically on boot. The devices reboot every day at 5 AM.
I've noticed that the google play store checks for updates when the device boots.
Unfortunately, it seems that the update won't perform while the app is opened.
To this I have 2 questions :
Is this odd behavior of update familiar to anybody (having the update not performing for the currently running apps)
How to solve this?
PS: I did think of updating the app versionCode on a third party server and if it's not up to date, close the app, let the update perform, then receive when the update is done performing to re-open the app.
But honestly, it feels like killing a fly with the bazooka.
I think you should depend on external server for this purpose.
App not being updated when running in foreground makes sense because Google play is not supposed to stop a running app which is necessary for updating it.
I recommend you to use Firebase cloud messaging service for the purpose. You can easily send data to the device using FCM.
I am developing an app where i need to keep background service running even if user uninstalls app. this is more like what uber did with its ios app to track users (https://www.wired.com/2017/04/uber-didnt-track-users-deleted-app-still-broke-rules/).
I tried to make service as system service which actual a bad idea.
ServiceManager.addService("downloader", new MyService());
looking forward for help.
I am developing an app where i need to keep background service running even if user uninstalls app.
That is not possible, fortunately.
I've developed an app which receives push notifications from Parse. The app is designed to run in background so that notifications can be received even when app is closed.
But we are facing challenge with Huawei's devices due to its custom "power savings" feature which detects the app as power intensive and hence clears it from memory when screen is locked.
Are there any known methods to prevent the app from being restricted or to add it to "Protected Apps" list upon installation?
Note: We begun with GCM notificatoins, but after learning that GCM's notification deliverability is flaky, we moved on to Parse.com's PPNS and then this new roadblock.
We cant do much except detect the device,if device is huawei warn the user about propably issue if the desired app wont be added to protected apps hence this is the only way to do what we need.No other ways available and i reckon it will never be!