报警管理器无法正常工作

时间:2015-02-25 14:05:17

标签: android connection alarmmanager

我安排了这样的闹钟

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);
}

在使用中,我将坐标发送到服务器,但问题是如果我关闭互联网连接,警报会停止重复。

0 个答案:

没有答案