1

after clear memory: - All service what running in background was killed. - All notification was removed. so : - How to restart service or keep it running in background after clean memory or was killed. - How to keep notification after clean memory. I see some application not in whitelist but it can restart service after killed

my device: OPPO os: 5.1.1

  • Clean memory can be a force kill which in the end kills the whole app's process to free up system memory used by the app. I don't think any app will be immune to a process kill. – ecle Dec 25 '18 at 12:02
  • It is a feature called **push notifications** https://stackoverflow.com/questions/17022985/restart-service-after-force-stop – ecle Dec 25 '18 at 12:04
  • i see has 1 app of my country which was received FCM notification after clean memory(it not work after force stop). i don't how they can keep service or app running(chathead) after clean. in my app, all was killed. – Nguyễn Thành Duy Dec 26 '18 at 07:13
  • @NguyễnThànhDuy got any solution? – felix Antony Mar 06 '22 at 07:47

1 Answers1

0

You could use START_STICKY, in method onStartCommand(). Here is more information.

Examples, with descriptions.

Dmytro Ivanov
  • 1,260
  • 1
  • 8
  • 10
  • thank for your reply , i have use START_STICKY in onStartCommand() but not work. i use sendBroadcast() on onTaskRemoved() and onDestroy() to restart , it not work. i try alarmservice but not work. i see in logs when clean memory, all method not call. service, IntentService, AlarmService, BroadcastReceiver was killed after clean memory. – Nguyễn Thành Duy Dec 25 '18 at 10:43
  • How do you clean memory? – Dmytro Ivanov Dec 25 '18 at 10:45
  • OPPO device has "Security Center". it has Clean up & accelerate that will clean up memory and cache junk file. – Nguyễn Thành Duy Dec 25 '18 at 10:57