• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps programmatically registered BrdCastReceiver doesnt execute on bootup

Hi,

I have registered a broadcast receiver to execute on boot up, programmatically. Here is the part of the code which i have used.

public class BootupTestingActivity extends Activity {
/** Called when the activity is first created. */

private BroadcastReceiver receiver;

@Override
public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button b = (Button) findViewById(R.id.button1);
OnClickListener onClickListener;
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.BOOT_COMPLETED");
filter.addCategory("android.intent.category.HOME");

receiver = new MyBroadCastReceiver ();

registerReceiver(receiver, filter);

}
});
}
}

I have also set the RECEIVE_BOOT_COMPLETED permission in the manifest file. This part of the code executes without any problem. But on bootup completion onReceive method of MyBroadCastReceiver doesnt get executed.
Can someone please guide me what i am missing here.

I dont see any error wrt to this code during /after the boot process also .
 
Back
Top Bottom