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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:54:47+00:00 2026-06-15T19:54:47+00:00

Previously, under desktop environment, to implement a stock price alert system, here is what

  • 0

Previously, under desktop environment, to implement a stock price alert system, here is what I do.

  1. Spawn a infinity running Thread.
  2. The thread will perform stock price query from stock server.
  3. The thread will perform all the necessary alerting actions based on retrieved stock price.
  4. The thread sleeps for N period. (N can be let’s say 30 minutes)
  5. Go back to 2.

When comes to mobile environment, power efficiency usage is a major consideration. The stock alert mechanism should keep running, even when I “close” the application using back button.

There are 2 ways out from my mind.

Use Service

  1. Spawn a infinity running Service.
  2. The service will perform stock price query from stock server.
  3. The service will perform all the necessary alerting actions based on retrieved stock price.
  4. The service sleeps for N period. (N can be let’s say 30 minutes)
  5. Go back to 2.

Use AlarmManager

  1. Install a BroadcastReceiver in AlarmManager.
  2. BroadcastReceiver’s onReceive will be triggered in next N period.
  3. When BroadcastReceiver is being triggered, perform stock price query from stock server.
  4. The BroadcastReceiver will perform all the necessary alerting actions based on retrieved stock price.
  5. Before returning from onReceive, install another BroadcastReceiver in AlarmManager for next N period.

I was wondering, which way is better? Is there any better ways other than the 2 ways? It seems to me AlarmManager is better, as we do not require to sleep for a long period, which seems sort of wasting resource?

  • 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-15T19:54:48+00:00Added an answer on June 15, 2026 at 7:54 pm

    Use AlarmManager to trigger a BroadcastReceiver then have the BroadcastReceiver start an IntentService.

    A BroadcastReceiver shouldn’t do any long-running tasks but it can start a Service to do work. An IntentService (which extends Service) will do work on a worker thread and then self-terminate.

    See IntentService

    And Extending the IntentService class

    In other words you can combine both ways that you are considering but without a continually running Service.

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

Sidebar

Related Questions

I'm trying to compile with g++ some code previously developed under Visual C++ 2008
I have an Access 2007 application (previously in Access 2003) that is running into
I was previously under the (naive) assumption that the modulus operator returned the remainder
Previously Called: How to deal with dynamically created controls under load in aspx in
Our server is running under CentOS 6 and handled over Panel Plesk 10.4.4. Structure
Here's the problem: I have a java dynamic web project under source control and
I'm having some dramas running svn log from a TeamCity server which I've previously
Previously under 10.4, 10.5 and 10.6 I stored authorization details into a file in
Previously I was working on one django project under the domain of abc.com and
I wan to place a VB.NET project under Git control in Windows (was previously

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.