I've looked around here for similiar problems, but for some reason my BroadcastReceiver never ends up receiving the android.intent.action.BOOT_COMPLETED Intent.
Here is my (relative) Android.Manifest File:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
<receiver android:name=".BootReceiver"
android:enabled="true"
android:exported="true"
android:label="BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
And Here is the actual Receiver.
public class BootReceiver extends BroadcastReceiver {
private static final String TAG="BootReceiver";
@Override public void onReceive(Context context,Intent intent){
try{
context.startService(new Intent(context,ConnectivityListener.class));
Log.i(TAG,"Starting Service ConnectivityListener");
}catch(Exception e){
Log.e(TAG,e.toString());
}
}
}
Thanks! Any help is greatly appreciated
You can emulate all broadcast actions by connecting via adb to the device and open a device shell.
Here we go:
adb shell
or on linux/mac ./adb shell
am broadcast -a android.intent.action.BOOT_COMPLETED
or whatever action you want to fireThere are a bunch of nice commands coming with adb or the adb shell. Just try it
Regards Flo
edit: oh damn, i wanted this answer as an answer on the "had to turn phone on/off every time". sorry folks