...我仍然不知道出了什么问题。希望有人可以帮助我,我在 Android 方面没有真正的经验。
这是我在 Reporter.java 中定义的警报服务:
alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent alarmIntent = new Intent(getBaseContext(), Reporter.MyReceiver.class);
PendingIntent pendingAlarmIntent = PendingIntent.getBroadcast(getBaseContext(), 0, alarmIntent, 0);
alarmMgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 1*1000, 1*30*1000, pendingAlarmIntent);
这是我接收的内部类:
public class MyReceiver extends BroadcastReceiver{
public MyReceiver(){
super();
}
public void onReceive(Context context, Intent intent) {
Log.e("log_cat","Alarm empfangen");
new GetControls();
}
}
这就是我添加到清单中的内容:
<receiver android:name="de.sonderfarben.tmc_reporter3.Reporter$MyReceiver" android:process=":remote"/>
谢谢!!