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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:20:33+00:00 2026-06-16T08:20:33+00:00

I have a service which I know is already running, how does my activity

  • 0

I have a service which I know is already running, how does my activity communicate with it without restarting the service.

to elaborate, I have a widget which starts a service, upon click an activity gets loaded, in that scenario the service should still be running.

How do I do something along the lines of:

  • conditionally checking if the service is alive
  • accessing methods in the service

Basically, the main thing I do not want to do is run startService(new Intent(...)) within my activity. I don’t want to run onStart again within my service.

Ideally I can just add some methods within my service class, and call those within my activity, like I would call any other public method in the project.

I want to start some new threads within my service, and I don’t want to make a second service class if I don’t have to.

Thanks for the insight

  • 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-16T08:20:34+00:00Added an answer on June 16, 2026 at 8:20 am

    The documentation on startService() might help:

    Request that a given application service be started. The Intent can either contain the complete class name of a specific service implementation to start, or an abstract definition through the action and other fields of the kind of service to start. If this service is not already running, it will be instantiated and started (creating a process for it if needed); if it is running then it remains running.

    …

    Returns

    If the service is being started or is already running, the ComponentName of the actual service that was started is returned; else if the service does not exist null is returned.

    So if your Service is already running, startService() won’t start a new version.

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

Sidebar

Related Questions

I have a service named WcfService2 (original i know) which has an IService.cs file
I have a service which is running in a system in several instances. I
I have web service which i want to use to upload image to the
I have web service which return json string like : d={main0ID:abc.es/main,main1ID:ah/main} I wanna append
I have web-service which give list of property at a particular area My problem
I have a service which has one endpoint , I have defined this endpoint
I have a service which creates a number of child processes. Using c# I
I have a service which takes the user supplied rich text (can have HTML
I am a little confused about Accept-Encoding . I have Web Service which would
I have an online service which uses a java applet to perform client side

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.