Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 接收机没有´;在安卓系统中,不要对警报做出反应_Android_Broadcastreceiver_Alarm - Fatal编程技术网

Android 接收机没有´;在安卓系统中,不要对警报做出反应

Android 接收机没有´;在安卓系统中,不要对警报做出反应,android,broadcastreceiver,alarm,Android,Broadcastreceiver,Alarm,。。。我仍然不知道出了什么问题。希望有人能帮助我,我在安卓方面并没有真正的经验 这是我的报警服务,在Reporter.java中定义: alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(getBaseContext(), Reporter.MyReceiver.class); PendingIntent pendingAlarmIntent

。。。我仍然不知道出了什么问题。希望有人能帮助我,我在安卓方面并没有真正的经验

这是我的报警服务,在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"/>


thanx

这是因为您在过去指定了一个时间。如果您试图让事件从现在起一秒钟内发生,并发出
已过的\u REALTIME\u唤醒
警报,请使用
SystemClock.elapsedRealtime()+1000
,而不是
1*1000


更新


此外,不能使用常规的内部类。您可以使用
静态
内部类或单独的公共类。常规内部类只能由外部类的实例实例化;Android没有这些功能。

也许这是一个错误。我得到:无法实例化接收器[…]没有空构造函数。但有一点:-(