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 8840213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:24:51+00:00 2026-06-14T10:24:51+00:00

I need some suggestions for approaches to take… Here’s some background info: Right now

  • 0

I need some suggestions for approaches to take…

Here’s some background info:
Right now I have an Android app and a separate java program running on my server.
The java program continuously go out and gets information from different sites and stores them in 14 different entries in an SQL database on the server.
The Android app then queries the databases to retrieve the info to be displayed.

My goal:
I need suggestions on how to have the app handle checking for updates from the database, and then letting the user know that there is new information.
My first thought is that maybe I need to start a separate thread that queries the database for a time modified. Then if it finds updates, it would pop up on the screen that there is new information.
I’m not too well educated with the way threads or services work, so I guess I’m looking for how to implement this, or whether there is a completely different way to go about update checking that would be better.

Thanks in advance, I appreciate any feedback, input, or suggestions.

  • 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-14T10:24:52+00:00Added an answer on June 14, 2026 at 10:24 am

    Hi Ryan
    I have also implemented a similar thing in my android app and surprisingly I also had 14 tables in my PostgreSQL Server.
    First of all, you would want to poll the server periodically even when the app is not in the foreground. For that you need to run a background Service – here you will have to manually create a thread in the service, because Service by default runs on the UI thread OR use an IntentService – you don’t have to create a separate thread. Whatever code you write in the intent service will be handled in a different thread automatically
    Now you have to make this service execute periodically. For that use an AlarmManager and use the setRepeating()function. In the arguments you have to give a PendingIntent to your Service or IntentService. But don’t use an alarm manager if you are going to poll the server for every less than 1 minute. Because the battery will be wasted a lot.
    Here is some code that might give you an idea :

    function setalarm()
    {
     Intent intent = new Intent(getBaseContext(), Intent_Service.class);
           PendingIntent sender = PendingIntent.getBroadcast(getBaseContext(), 192837, intent, PendingIntent.FLAG_UPDATE_CURRENT);
           Random randomGenerator = new Random();
         long interval=60000;  //1 minute in milliseconds
         AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
           am.setRepeating(AlarmManager.RTC, cal.getTimeInMillis(),interval,sender);
    }
    

    This is Intent_Service of type IntentService :

    public class BackService extends IntentService
    {
    
     Context context=this;
    
     //public Timer t=null;
     public BackService()
     {
     super("myintentservice");
     }
    
     @Override
     protected void onHandleIntent(Intent intent) 
     {
      try
      {
         PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
          wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
          wl.acquire();
            //..CPU will remain on during this section..
    
         //make our network connections, poll the server and retrive updates
       //Provide a notification if you want
    
        wl.release();//Release the powerlock
      }
    }
    
    }
    

    But if you want instantaneous updates, then use Google Cloud Messaging Services. To know more about how it works see this

    Hope this helps you.

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

Sidebar

Related Questions

I need some asp.net pagination code samples. I would like suggestions on open source
Need some regular expressions help. So far I have my code working to allow
Need some help... I have jasperserver 4.1 installed on my ubuntu. It runs via
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview
I was hoping to get some suggestions on some best approaches to develop a
I need to create an algorithm to layout some hierarchical data but have never
Here's my predicament. I have an app that I would like to update to
Need some advice on how best to approach this. Basically we have a few
I just need some ideas for an approach to sorting results. Here's the scenario:

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.