我使用以下代码启动了一个广播接收器,它在指定时间后调用一个新的意图,但问题是没有调用意图。警报由屏幕上的按钮调用,当在指定时间后单击该按钮时,预计将启动新意图。
private void alarm(){
br = new BroadcastReceiver() {
@Override
public void onReceive(Context c, Intent i) {
Toast.makeText(c, "Rise and Shine!", Toast.LENGTH_LONG).show();
}
};
Log.v("ranjith","Inside setup");
registerReceiver(br, new IntentFilter("com.example.ads.test"));
pendingIntent = PendingIntent.getBroadcast( this, 0, new Intent(getApplicationContext(),test.class),0);
alarmManager = (AlarmManager)(this.getSystemService( Context.ALARM_SERVICE ));
}