Ugly fugly example of android sensors working in background for long period of time. Data collected of Bluetooth, Location and Light sensors. Foreground service is used to ensure background work is not interrupted by system.
- Data is being collected in background independently if Android Activity exists or not.
- Data from all providers is shown in system notifications bar.
- After resuming to app (after Activity destory) new activity shows all collected data while application was working in background.
- Press
back
button while activity is in Foreground. - Turn-on
Do not keep activities
in Dev settings. - Running on low resources device for longer period of time / filling memory from other apps.