Repository navigation
Description
Avoid draining the battery to eagerly deploy DB when it's not always going to be useful for the user and the device battery might be low.
Code:
- ModuleReceiver
commons-android/src/main/AndroidManifest.xml
Lines 82 to 108 in 9c86032
<!-- MODULE CHANGE RECEIVER --> <receiver android:name=".receiver.ModuleReceiver" android:exported="true"> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_CHANGED" /> <action android:name="android.intent.action.PACKAGE_DATA_CLEARED" /> <action android:name="android.intent.action.PACKAGE_FIRST_LAUNCH" /> <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_NEEDS_VERIFICATION" /> <action android:name="android.intent.action.PACKAGE_REMOVED" /> <action android:name="android.intent.action.PACKAGE_REPLACED" /> <action android:name="android.intent.action.PACKAGE_RESTARTED" /> <action android:name="android.intent.action.PACKAGE_VERIFIED" /> <data android:host="${applicationId}" android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> <action android:name="android.intent.action.MY_PACKAGE_SUSPENDED" /> <action android:name="android.intent.action.MY_PACKAGE_UNSUSPENDED" /> </intent-filter> </receiver>
Links:
- https://developer.android.com/training/monitoring-device-state/battery-monitoring
- https://developer.android.com/topic/performance/background-optimization
- https://developer.android.com/reference/android/os/PowerManager
Activity
Package broadcast receiver > ping only if battery good
[-]broadcast receiver> skip work if low battery [/-][+]Package broadcast receiver > skip work if low battery [/+]