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

  • SEARCH
  • Home
  • 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 8310115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:20:32+00:00 2026-06-08T19:20:32+00:00

I got a problem. Every once in a while, the IntentService UpdateService02 fails to

  • 0

I got a problem. Every once in a while, the IntentService UpdateService02 fails to run. I put log entries in so I could debug and here’s what I get…

02-28 21:37:32.461: Main – Broadcast Sent

02-28 21:37:32.484: BroadcastReceiver – Main Started; Set Alarm

02-28 21:37:32.539: BroadcastReceiver – Received AlarmService

02-28 21:38:32.500: BroadcastReceiver – Received AlarmService

Usually this should happen:

02-28 21:37:32.461: Main – Broadcast Sent

02-28 21:37:32.484: BroadcastReceiver – Main Started; Set Alarm

02-28 21:37:32.539: BroadcastReceiver – Received AlarmService

02-28 21:38:32.500: UpdateService — onHandleIntent()

Any ideas? Here’s my Broadcast Receiver code…

Broadcast Receiver:

public class AlarmReceiver extends BroadcastReceiver {

    private static final int INTERVAL = 60*1000; // check every 60 seconds

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction() != null) {
            if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
                Log.v(TAG, "BroadcastReceiver - Received Boot Completed; Set Alarm");
            
                setRecurringAlarm(context);
            }else if(intent.getAction().equalsIgnoreCase(Main.BROADCAST_STARTUP)){
                Log.v(TAG, "BroadcastReceiver - Main Started; Set Alarm");
            
                setRecurringAlarm(context);
            }else{
                Log.v(TAG, "BroadcastReceiver - Received " + intent.getAction());
            }
        }else{
            Log.v(TAG, "BroadcastReceiver - Received AlarmService");
        
            Intent i = new Intent(context, UpdateService02.class);
            context.startService(i);
        }
    }

    private void setRecurringAlarm(Context context) {
        Intent receiver = new Intent(context, AlarmReceiver.class);
        PendingIntent recurringDownload = PendingIntent.getBroadcast(context, 0, receiver, PendingIntent.FLAG_CANCEL_CURRENT);
        AlarmManager alarms = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        alarms.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), INTERVAL, recurringDownload);
    }
}

Intent Service:

public class UpdateService02 extends IntentService {

    static DefaultHttpClient mClient = Client.getClient();
    private static final int LIST_UPDATE_NOTIFICATION = 100;

    public UpdateService02() {
        super("UpdateService02");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        Log.v(TAG, "UpdateService -- onHandleIntent()");
    
        try {
            HttpGet httpget = new HttpGet(url);
            HttpResponse response;
            response = mClient.execute(httpget);
            BufferedReader in = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
        
            Intent i = new Intent(BROADCAST_UPDATE);  
            i.putExtra("text", in.readLine().toString() + " updated");
            sendBroadcast(i);
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

I thought it might be I need to set the intentservice startup’s context to be the applications, but I honestly have no idea.

  • 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-08T19:20:34+00:00Added an answer on June 8, 2026 at 7:20 pm

    I figured out the problem…

    I changed this:

    try {
        HttpGet httpget = new HttpGet(url);
        HttpResponse response;
        response = mClient.execute(httpget);
        BufferedReader in = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
    
        Intent i = new Intent(BROADCAST_UPDATE);  
        i.putExtra("text", in.readLine().toString() + " updated");
        sendBroadcast(i);
    } catch (ClientProtocolException e) {
    

    to this:

    try {
        HttpGet httpget = new HttpGet(url);
        HttpResponse response;
        response = mClient.execute(httpget);
        BufferedReader in = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
    
        Intent i = new Intent(BROADCAST_UPDATE);  
        i.putExtra("text", in.readLine().toString() + " updated");
        sendBroadcast(i);
        in.close();
    } catch (ClientProtocolException e) {
    

    Sometimes the reader would get “clogged” up and the next time it got called it would still be stuck trying to work on the last request. Adding in.close(); made sure I closed it after every usage. Works great now.

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

Sidebar

Related Questions

I've got problem while including header files, in every header file i use #pragma
I got a strange problem. I have a tabcontrol and 3 tabs. On every
I want to ask about strcpy. I got problem here. Here is my code:
Alright, I've got an interesting issue. My page makes a JSON request every once
I got stuck in a $_SESSION problem, while $_SESSION is randomly losing its data.
Hey everyone I got a javascript problem I can't seem to find a specific
i got problem with my code and hopefully someone able to figure it out.
I got problem with sending data in Android using httpPost. I found some example,
I've got problem with DirectX in C#. I want to draw some lines. Firstly
I've got problem for my application. I want to start connectbot from my application

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.