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

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

Related

How to make the flutter app on android that constantly run in the background until force stop or uninstall it?

I want to create an app to send the user's position via the API.
My requirements are:
The app must auto-start in the background when after the mobile is powered on.
Swiping the app doesn't stop the app from working.
Only the user pressing Force stop or Uninstall to stop this app from working.
checkout this package it will help you to run your code in the background
workmanager: ^0.5.1

Xamarin Forms [Android] Silent Push while App in Background => Freeze

I have a App that i now wanted to expand with Silent Push Functionality for a customers Feature Request.
But now i encounter a rather strange behaviour(app freeze)
The Used Xamarin.Forms Version is 4.8.0.1451 (Updates did not solve the problem)
The Problem is Android Only related
Normal Notifications work as expected and dont produce any error
Here the quick Behaviour:
Receiving Silent Pushes works if the app is in Foreground (Multible times no limit)
Bringing the App to the Background and back to Foreground works also flawles
Do i Receive a Silent Push while the App is in Background or the Device is Locked and i bring back the App to Foreground/Unlock the device the app seems frozen (unresponsive and App.OnResume does not get executed)
(Also to note: i can only receive 1 silent push when the app is in Background/Device is locked)
For now i dont do anything on receiving the Silen push (to isolate this error)
Debug output aswell as LogCat does not provide any info what so ever.
i could not track any managed code that does execute and not return properly from some method calls
i can reproduce this problem on android 11(Pixel3) and android 9(Blackview A60)
I hope someone here has an idea what this problem could be.
It more informations or details are needed, i happily provide
In Android, starting in Android 8.0 (API level 26), an Android application no longer have the ability to run freely in the background.
When in the foreground, an app can start and run services without
restriction. When an application moves into the background, Android
will grant the app a certain amount of time to start and use services.
Once that time has elapsed, the app can no longer start any services
and any services that were started will be terminated. At this point
it is not possible for the app to perform any work.
For more details about this, you can refer to Background Execution Limits in Android 8.0.

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

how to restart Cordova app after it is killed

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..

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