My broadcastreceiver doesnt work, i dont get the message in the log, can you please help me? This is my broadcastreceiver:
public class BootReceiver extends BroadcastReceiver{
public static SharedPreferences prefs;
@Override
public void onReceive(Context context, Intent intent) {
prefs = PreferenceManager.getDefaultSharedPreferences(context);
// TODO Auto-generated method stub
Log.w("A intrat in BootReceiver"," ");
if (!(prefs.getString(NotificareOptions.OptionsPos, "2")).equals("1"))
context.startService(new Intent(context, ServiceNotif.class));
}
}
i got the permission, and i have the receiver declared in the manifest.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name=".BootReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter android:priority="500" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Where is the problem? I also heard that RECEIVE_BOOT_COMPLETED
doesnt work on all android phones.