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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:02:46+00:00 2026-05-26T05:02:46+00:00

I am trying to create a service that will handle file I/O in the

  • 0

I am trying to create a service that will handle file I/O in the background. Activities that update the data will bind to the service and call the service’s methods to perform the I/O. I am using the Android documentation for guidance.

My service does not seem to want to start, however. In the onCreate() method of my Activity, I have:

Intent smsIntent = new Intent(this, SurveyManagerService.class);    
String surveyFilename = getIntent().getStringExtra("surveyFilename");   
System.out.println(startService(smsIntent)); //testing if it starts
SurveyManagerServiceConnection connection = new SurveyManagerServiceConnection();
sms = connection.getSurveyManagerService();

At line 3 LogCat outputs a ComponentInfo object, so it would appear that the service is created; however, sms is null. Furthermore, the SurveyManagerService onStartCommand() method never seems to be called:

@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
    System.out.println("starting service");
    Toast.makeText(this, "service starting", Toast.LENGTH_SHORT).show();
    openSurveyFromIntent(intent);
    return START_REDELIVER_INTENT;
}

I never see any “starting service” output in LogCat, nor does the Toast appear.

My service is declared in my manifest as:

<service android:name=".SurveyManagerService" android:exported="false" android:enabled="true">
</service>

Am I missing something obvious? Let me know what other information I should provide to diagnose the problem.

  • 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-05-26T05:02:46+00:00Added an answer on May 26, 2026 at 5:02 am

    It seems the onCreate() method has to exit before the service can actually start. Once I removed the getSurveyManagerService() request, and once a bit of time had passed, I received the System.out messages indicating the service was starting.

    Unfortunately that creates another problem: the Activity relies on the Service for its data, so I need to determine how to cause the Activity to wait for the service to start.

    EDIT: My solution was to create a private subclass of my ServiceConnection in my Activity. I then overrode the onServiceConnected() method to provide the Activity with its data (populating a ListView, in this case).

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

Sidebar

Related Questions

I'm trying to create a service bean that when referenced will be initialized with
I'm trying to create an MVC view that will display some data in a
I'm trying to create an OData service that will use authentication & authorization provided
I'm trying to create an Integration Service project that will use a set of
I am trying to create a WCF service that will use message mode security
I'm currently trying create a service that will return results of a OLAP cube
I am trying to create a rest service that will return a list of
I am trying to create an OSGi service that wraps another jar. I added
I'm trying to create an application that uses c2dm service. So. First I used
I'm trying to create a service in which the user will input some text

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.