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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:18:13+00:00 2026-06-05T18:18:13+00:00

I am new to Android services so I had some questions that would clarify

  • 0

I am new to Android services so I had some questions that would clarify how I could use them in my current project.

1) Do I need to have my application running to have the service running? Do I have to launch the application for the services to start?

2) I want to print a text on the screen at the end of my service run. First, is it possible and second, will I be able to see this text on the Activity UI when I switch to the Activity’s screen?

3) I want my service to use variables and functions that are implemented in the main Activity class. Is it possible?

4) Related to question 3: I have an AsyncTask in my current application that repeats every minute using a TimerTask. I want to have the same functionality, but this time running in the background when user is busy doing something else. Is Service the right thing to do that? Can I accomplish that by running my searchRegularly() (which is in the Activity) function from the Service? Below, backgroundSearch is the name of the AsyncTask that runs every minute.

    public void searchRegularly() {

    TimerTask doAsynchronousTask;
    final Handler handler = new Handler();
    searchTimer = new Timer();
    doAsynchronousTask = new TimerTask() {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            handler.post(new Runnable() {
                public void run() { 

                      backgroundSearch = new SearchTask();
                      backgroundSearch.execute();
                }
            });

        }

    };

    searchTimer.schedule(doAsynchronousTask, 1000,60000);

}

5) How do you decide to use whether a Service or an IntentService? What is the main difference?

  • 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-05T18:18:16+00:00Added an answer on June 5, 2026 at 6:18 pm

    1) No. But the application (I mean the Application class in Manifest, not activity) will be created before your service

    2) Do you mean “toast“? Yes

    3) Though it’s possible with some tricks, this is not recommended. Rethink your design.

    4) Service can do, or you can consider AlaramManager

    5) Service itself should be a Singleton, no two service of the same class will be running at the same time; for Service, if you call multiple StartService, and if Service is already running, it will not Start twice. But IntentService will work on multiple “start” simultaneously.

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

Sidebar

Related Questions

Somewhat new to android, need some help with services. I have a service which
A new question about android and services. Currently I'm developing a App that should
I'm trying to list some JmDNS services that I discover in my Android app
when i am creating new android project from visual studio 2010 it gives the
I am a new android app developer and i want to use google map
When I start a new Android project in Eclipse (Helios), the strings.xml has 2
In the test project for my android app I initially had a series of
Android's AlarmManager Javadoc states When an alarm goes off, the Intent that had been
I have some web services that uses WSDL/SOAP for communication. Specifically, I am using
I am new to android and I have written a program that displays the

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.