Welcome to the Android Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread Author  Thread Author    #1  

    Default Android Alarm reset after reboot not working

    I have one class called StopAlarmReceiver and another BootHandler.
    The BootHandler resets the alarm after reboot, which was set before the boot. My problem is that the BootHandler sets the alarm but not getting fired.

    Entries in Manifest file.
            android:exported="true" >
            android:exported="true" >
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
    Code in BootHandler.

    AlarmManager mgr= (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
    Intent i = new Intent(context, StopAlarmReceiver.class);
    PendingIntent pi = PendingIntent.getService(context, 1, i, 0);
    long time = sharedPreferences.getLong("Old_time", 0);
    Log.e(TAG, "New time: " +new Date(SystemClock.elapsedRealtime() + time));
    mgr.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + time, 5000, pi);
    The above code runs without any problem immediately after reboot and I can see the log with the time. But the problem is that it should fire after each and every five seconds but it won't!

    I hold the below permission .
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    Please help!

Similar Threads

  1. Noir [Game, Free, Puzzle, Android 2.3+]
    By Serg Maneken in forum Android Games
    Replies: 2
    Last Post: 05-06-2014, 06:44 AM
  2. Do not want to restore...
    By RionDunn in forum Samsung Galaxy S5
    Replies: 5
    Last Post: 05-05-2014, 02:45 PM
  3. Grey WiFi bars after using Market Unlocker Pro...
    By daniel1303 in forum Android 4.1 / 4.2 / 4.3 Jelly Bean
    Replies: 1
    Last Post: 05-05-2014, 08:09 AM
  4. Which Android phone should i buy?
    By astoria0128 in forum General Android Device Chat
    Replies: 5
    Last Post: 05-05-2014, 04:03 AM

Posting Permissions