0
我創建一個內部接收器InnerReceiver內部廣播接收器不工作?
public class MainActivity extends Activity{
...
class InnerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.v("InnerReceiver", "onReceive");
}
}
...
}
接收器被稱爲如下:
AlarmManager mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
PendingIntent pi=PendingIntent.getBroadcast(context, 0, new Intent(context,MainActivity.InnerReceiver.class), 0);
mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime()+1000,
10000,
pi);
內部類被聲明爲:
然而,內部接收器不會被調用!有什麼問題嗎 ? 謝謝。