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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:42:40+00:00 2026-06-03T20:42:40+00:00

In android development, I have service that started by Brodcastreceiver ,and it started and

  • 0

In android development, I have service that started by Brodcastreceiver ,and it started and did its task properly , but when I try to stop the service from its class by using stopself(); it did not stop until performing its task three times and then its stop here is the code for the onStart service and onDestroy();:

@Override
    public void onStart(Intent intent, int startid) {
        player.start();
        SystemClock.sleep(30000);
        onDestroy();
    }

    @Override
    public void onDestroy() {
        player.stop();
    this.stopSelf();}   

and here is the code when I started the service from the BrodcastReceiver:

Intent intent =new Intent(context,RingService.class);
context.startService(intent);

Is there any way to make my service stop immediately once its finished its task by itself , or do I have to make the BrodcastRecevicer stop it?

any help or redirection to solve this issue will be completlly appreciated

regards

  • 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-03T20:42:41+00:00Added an answer on June 3, 2026 at 8:42 pm

    Just call stopSelf() at the end of onStart instead of the onDestroy() call and remove the stopSelf() call from onDestroy().

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

Sidebar

Related Questions

I have an error with android development. In fact i try to parse a
I just started with PhoneGap development and have my first sample android app running
I have just started studying Android, I have limited java knowledge but am semi
A lot of open source libraries that aid in Android application development have sprung
Im getting started with android development and i have a few questions about supporting
I have just started android development 3 days ago and I'm trying to develop
Let me start by saying I am new to Android development but have a
I started android development.I have always made ​​use of emulators and eclipse. Because I'm
I want install Android version 1.6 SDK. I already have Android development setup with
I have been learning android development and I am still new to this. I

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.