我安排了这样的闹钟
private void startAlarm() {
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
Intent intent = new Intent(this, LocationBrodcastReceiver.class);
alarmIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis(), 120000, alarmIntent);
}
我有WakefulBroadcastReceiver
@Override
public void onReceive(Context context, Intent intent) {
Intent intentService = new Intent(context, LocationService.class);
startWakefulService(context, intentService);
}
在使用中,我将坐标发送到服务器,但问题是如果我关闭互联网连接,警报会停止重复。