Skip to content

Restart service on device reboot

mehdi sohrabi edited this page Apr 26, 2020 · 1 revision

Restart service on device reboot (Android only)

  1. Add the boot receive permission to AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  1. Register BootBroadcastReceiver inside application tag:
<application
...
...
...

    <receiver android:name="rekab.app.background_locator.BootBroadcastReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
...
...
...
</application>
Clone this wiki locally