Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8859027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:57:34+00:00 2026-06-14T14:57:34+00:00

So I have a BroadcastReceiver which looks like this: public class UpdateReceiver extends BroadcastReceiver

  • 0

So I have a BroadcastReceiver which looks like this:

public class UpdateReceiver extends BroadcastReceiver {

    public UpdateReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.SECOND, 10);
        System.out.println("Broadcast received");       

        PendingIntent operation = PendingIntent.getService(context, 0,new Intent("REFRESH_THAT"), PendingIntent.FLAG_UPDATE_CURRENT);       
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, System.currentTimeMillis(), cal.getTimeInMillis(), operation);
    }
}

This is how I call the BroadcastReceiver

 Intent in = new Intent ("REFRESH_BROADCAST");       
 sendBroadcast(in);

And this is my intent-filter in Android Manifest file

<service android:name = ".services.RefreshService">     
    <intent-filter>
        <action android:name="REFRESH_THAT"/>
    </intent-filter>
</service>

<receiver android:name=".services.UpdateReceiver">        
    <intent-filter>
        <action android:name="REFRESH_BROADCAST"/>        
    </intent-filter>    
</receiver>

BroadcastReceiver received a brodcast without any problem, but AlarmManager seems to do nothing. If I call operation.send() it works without a problem, so I presume there is something wrong with AlarmManager.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:57:35+00:00Added an answer on June 14, 2026 at 2:57 pm

    Alright so finally I found a solution a it was my fault.

    I have set int type to AlarmManager.ELAPSED_REALTIME and long triggerAtMillis to System.currentTimeMillis() property of alarmManager.setInexactRepeating(.....) which is wrong, it only can be paired with AlarmManager.RTC / RTC_WAKEUP.

    So the functional code is this:

    PendingIntent operation = PendingIntent.getService(context, 0,new Intent("REFRESH_THAT"), 0);       
            AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
            alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() , 30000, operation);
    

    I should really read API documentation more carefully. If you hover AlarmManager.ELAPSED_REALTIME , it will told you what kind of time trigger you have to use. Hope this my stupid mistake will help someone in future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application with BroadcastReceiver which listens to SD card mount/unmount, like: public class
I have an Alarm Manager which send Intent to BroadcastReceiver. This Broadcast is not
I have a Sms Broadcast Receiver class that extends broadcastreceiver to handle incoming sms,
Have a BroadcastReceiver which I want to create a PendingIntent inside the onReceive method
In my Android application, I have a DefaultApplication class which extends android.app.Application , and
Well, I have a class extending broadcastreceiver which is listening for messages. Now whenever
At boot, I have a BroadcastReceiver which launches a Service . In this Service
I have an AlertDialog which appears initiated by a BroadcastReceiver - so the AlertDialog
I have an broadcast-receiver that looks like the following within an activity named childActivity
Has been struggling on this for a week I have two classes WiFiScanReceiver which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.