Removing App from 'Overview' force stops it [with/without root]

294 Views Asked by At

I am faced with a difficult problem.

The test device that i need to execute the objective on:
Device: Micromax Bharat 5 Plus (2018 model)
Android Version: 7.0

I have an Android app which critically relies on push notifications. The device I'm using however, has a default System setting which causes the Apps that are swiped off the Overview Tab to be completely Force Stopped. This device has a 2GB RAM capacity, which makes this setting understandable. However, this makes any kind of App service/task/notification unexecutable.

To try and change this setting I have tried several different things:

  • Changed and discarded all Battery Optimizations
  • Set high priority to all notifications related to said app
  • Intent filters, background service, START_STICKY

But a Force Stop stops all App processes. There's no possibility from within the App code. Thus i rooted the device and tried the following root options:

  • Removed all System Apps that were consuming unnecessary RAM
  • Used Memory Locker to change the App OOM_adj priority to -17(lowest value)

Again this still doesnt circumvent the problem of swiping off causing Force Stop.

Things that might work but havent found a way:

  • Adding a way to permanently 'lock' the App to the drawer, disallowing the user from removing it(not concerned about UX)
  • Flashing a different custom ROM entirely that has different system defaults(I couldnt find a single custom ROM for this rather uncommon device)
  • Figuring out a way to change the default setting of 'Force stopping' apps on removing from drawer. (Ideal but how?)

This is an extremely frustrating problem that i haven't found a solution to. There are multiple devices of this exact model that need to be distributed and rely on notifications. A solution to this would really be sincerely appreciated.

1

There are 1 best solutions below

2
On BEST ANSWER

Hey i also have same device to test and build my app for chinesse manufacturers.

I found a solution (copied from skype).

Just add this line in your (manifest) launcher activity.

android:excludeFromRecents="true"

Basically this will remove your app from recent menu and almost all this type of device force stop your app when you remove it from recent menu.

Also in stock android there is nothing like that so you should not do this on that device or just add an option which explains your user what is going on.