I'm trying to listen for reboot event.
I'v created the following class:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("MYBOOTRECEIVER", "HELLO!");
}
}
and then in the manifest file I've putted the following xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage"
android:installLocation="internalOnly"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:label="@string/app_name" >
<receiver android:name=".OnBootReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
</manifest>
However, after I've installed this app and rebooted the device, nothing happens. (I'm using a galaxy tab 8.9 with android 3.2 on it). As you can see from the manifest I've installed the app on internal memory (like suggested on similar questions here on stackoverflow) ... I've also putted a Quickboot_poweron action (to see if galaxy tab have similar behaviour of htc devices) ... but nothing. I hope that someone can help me!
The problem is that with Honeycomb and beyond, broadcast signals do not automatically start an application which has not been otherwise started. There is a flag that can be used to change this however the BOOT_COMPLETED broadcast does not carry that flag. You need to be installed on the system partition in order to overcome this nuance.
If you're not able to be installed on the system partition, you'll need to find some other way to be started -- either by convincing the user to start you manually, or having the user install a widget you provide, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With