In order to catch android.intent.action.BOOT_COMPLETED events, is it enough just to register the BroadcastReceiver in the AndroidManifest.xml? like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myDomain.myApp"
android:installLocation="internalOnly">
<!-- ... stuff ... -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- ... stuff ... -->
<application ...>
<!-- ... stuff ... -->
<receiver android:name=".bgServices.MyBootBroadcastReceiver">
</receiver>
<!-- ... stuff ... -->
</application>
</manifest>
The BroadcastReceiver:
package com.myDomain.myApp.bgServices;
// imports ...
public class MyBootBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("my-log", "MyBootBroadcastReceiver.onReceive()");
Toast.makeText(context, "YEAY!", Toast.LENGTH_LONG).show();
}
}
I'm asking because I'm sending:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n com.myDomain.myApp/.bgServices.MyBootBroadcastReceiver
But nothing happens.
(and I run the app, not just pushing it to the device)