alarmmanager

AlarmManager can't work on android 6.0

ⅰ亾dé卋堺 提交于 2019-12-07 06:16:58
问题 I am working with AlarmManager, It is not working on android os 6.0. This is my code: private void startAlarmManager(String id) { userID = GlobalValue.getUserName(GuideNavigationActivity.this); Context context = getBaseContext(); alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); gpsTrackerIntent = new Intent(context, GpsTrackerAlarmReceiver.class); gpsTrackerIntent.putExtra("id", id); gpsTrackerIntent.putExtra("userID", userID); gpsTrackerIntent.putExtra("idCourse

Android Background Service vs AlarmManager

亡梦爱人 提交于 2019-12-07 05:56:40
问题 Can someone give a little bit briefing or perhaps more elaborate details on differences Android background service with Alarm Manager? How they differ? And in which situation I should use each? I am developing an application that need to download data from Web Service at periodic time. The application has few modules and each modules has different interval time period to download / sync the data to Web Service. Let say + Module A need to sync in every 15 mins + Module B need to sync in every

Alarm set in App with AlarmManager got removed when App Force Stop

元气小坏坏 提交于 2019-12-07 04:54:24
I am trying to create an alarm using AlarmManager it works fine even when device is locked. But when I kill the application using Settings -> Manege App -> MyApp -> Force Stop then my alarm destroys all the settings . So please tell me how to save my alarm settings after application is killed even by forced stop and it notifies me on its usual time. Thanks in advance... Lalit Poptani But when I kill the application using Settings -> Manege App -> MyApp -> Force Stop then my alarm destroys all the settings. AlaramManager is critical system service that runs all the time. And if your application

Android Alarm Manager Set Repeating at Specific Timing

时光总嘲笑我的痴心妄想 提交于 2019-12-07 03:29:29
I am having some problem with alarm manager in Android. So what I am trying to do is set the alarm to repeat to run the DB insertion every day around 12.01AM. Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0 ); calendar.set(Calendar.MINUTE, 1); notificationCount = notificationCount + 1; AlarmManager mgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent notificationIntent = new Intent(context, ReminderAlarm.class); notificationIntent.putExtra("NotifyCount", notificationCount);

Android Studio stack=java.lang.NoClassDefFoundError: Failed resolution of: Landroid/icu/util/Calendar;

拥有回忆 提交于 2019-12-07 02:54:15
问题 sorry my english is not very good but. i use the calendar class for a alarm app with the alarm manager, but i have a error with the instance of the class calendar. i investiged in other forums but i not find poblem what is. please i need your help. the error is marked in the instance of the calendar class enter image description here 回答1: As far as i can see, you could just use the normal Calendar instead of the in API 24 introduced ICU Calendar. Try to use this import java.util.Calendar

Pending intent with ONE_SHOT flag

半世苍凉 提交于 2019-12-07 01:30:54
问题 Currently I've got this code: public static void setupAlarm(Context context) { Intent myIntent = new Intent(context, Receiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, myIntent, PendingIntent.FLAG_NO_CREATE); if (pendingIntent != null) { return; } else { pendingIntent = PendingIntent.getBroadcast(context, PENDING_INTENT_RETRY, myIntent, PendingIntent.FLAG_ONE_SHOT); } AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

Android AlarmManager in a Broadcastreceiver

[亡魂溺海] 提交于 2019-12-06 22:28:24
问题 I have braodcastreceiver, that broadcast receiver shall schedule an alarm. Usually I would do AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); am.set(AlarmManager.RTC, time, myPendingIntent); The problem is that getSystemService is not available in a Broadcast receiver only in an Activty. How would I do it here? Thanks, A. 回答1: AndyAndroid, getSystemService() is part of the Context . You will need to save the Context you receive in your onReceive() method like so... private

Android repeat alarm manager in not triggering immediately

非 Y 不嫁゛ 提交于 2019-12-06 17:26:39
My code: Calendar calSet = Calendar.getInstance(); calSet.set(Calendar.HOUR_OF_DAY, 11); calSet.set(Calendar.MINUTE, 20); calSet.set(Calendar.SECOND, 0); calSet.set(Calendar.MILLISECOND, 0); PendingIntent pi=PendingIntent.getBroadcast(context,0,myIntent,PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP,calSet.getTimeInMillis(),pi); and say, I'm executing at 11:30. Alarm triggers immediately (which is expected). But, for the same when I use alarmManager.setRepeating(AlarmManager

Didn't include a pendingIntent in the extras?

狂风中的少年 提交于 2019-12-06 17:05:58
问题 I came across this Error message on Logcat while working on an app. Can anyone tell me what it means? 07-24 23:34:20.288 1140-1140/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid parameter app 07-24 23:34:20.288 1140-1140/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid package name : Perhaps you didn't include a PendingIntent in the extras For your information: I used an AlarmManager in this app 回答1: It is probably means that you are missing a uses-library deceleration inside the

JobScheduler: controlling delay from constraints being met to job being run

混江龙づ霸主 提交于 2019-12-06 17:01:02
问题 I'm using JobScheduler to schedule jobs. Mainly I'm using it for the .setRequiredNetworkType() method, which allows you to specify that you only want the job to be scheduled when a network connection (or more specifically an unmetered connection) is established. I'm using the following pretty straightforward code to schedule my jobs: PersistableBundle extras = new PersistableBundle(); extras.putInt("anExtraInt", someInt); int networkConstraint = useUnmetered ? JobInfo.NETWORK_TYPE_UNMETERED :