I want to start my application when phone startup
I just follow tutorial from here but it doesn\'t work in my device. Please see my method:
public c
I've done something similiar, but I was starting activity. Here is how I done it:
In Manifest:
In Java code:
public class BootUpReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
PendingIntent i = PendingIntent.getActivity(context, 0, new Intent(
context,MainActivity.class),
Intent.FLAG_ACTIVITY_NEW_TASK);
AlarmManager mgr = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 20000, i);
}
}
Your code seems to be correct, but try using PendingIntent ;) Hope it helps you