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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:03:43+00:00 2026-06-14T11:03:43+00:00

I am developing an app that will work from API 8 through API 16.

  • 0

I am developing an app that will work from API 8 through API 16.

At start up, the program is supposed to bind to my local service.

When testing on an AVD with settings for API 16, I have had no issues, with service binding or anything else.

When testing on an AVD with settings for API 8, it will not bind to my local service at all.

Here is my logcat:

11-15 10:35:57.220: E/AndroidRuntime(326): FATAL EXCEPTION: main
11-15 10:35:57.220: E/AndroidRuntime(326): java.lang.RuntimeException: Unable to start activity ComponentInfo{timesheetdb.Login/timesheetdb.Login.TimesheetConnect}: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=timesheetdb.Login/timesheetdb.Services.SocketService }
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.os.Looper.loop(Looper.java:123)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-15 10:35:57.220: E/AndroidRuntime(326):  at java.lang.reflect.Method.invokeNative(Native Method)
11-15 10:35:57.220: E/AndroidRuntime(326):  at java.lang.reflect.Method.invoke(Method.java:521)
11-15 10:35:57.220: E/AndroidRuntime(326):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-15 10:35:57.220: E/AndroidRuntime(326):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-15 10:35:57.220: E/AndroidRuntime(326):  at dalvik.system.NativeStart.main(Native Method)
11-15 10:35:57.220: E/AndroidRuntime(326): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=timesheetdb.Login/timesheetdb.Services.SocketService }
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ContextImpl.bindService(ContextImpl.java:874)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
11-15 10:35:57.220: E/AndroidRuntime(326):  at timesheetdb.Login.TimesheetConnect.onStart(TimesheetConnect.java:47)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.Activity.performStart(Activity.java:3781)
11-15 10:35:57.220: E/AndroidRuntime(326):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
11-15 10:35:57.220: E/AndroidRuntime(326):  ... 11 more

What I do not understand, is why there is a SecurityException saying I am not allowed to bind to the service. I can bind to it in API 16, but I cannot in API 8. It’s not logical.

Please, can someone help?

As per request:
It’s not the entire code, just the pieces that handle the binding when the Activity begins.

private SocketService mainService;
private ServiceConnection serviceConn;
private boolean isServiceBound;

@Override
protected void onStart() {
    super.onStart();

    // First create ServiceConnection
    createServiceConnection();

    // Bind to SocketService
    Intent sInt = new Intent(this, SocketService.class);
    if ((isServiceBound = bindService(sInt, this.serviceConn,
            Context.BIND_AUTO_CREATE))) {
        Log.i("info", "Service has been bound.");
    }
}

@Override
protected void onStop() {
    super.onStop();

    if (isServiceBound) {
        unbindService(serviceConn);
        isServiceBound = false;
    }
}

@Override
protected void onDestroy(){
    super.onDestroy();

    if (isServiceBound) {
        unbindService(serviceConn);
        isServiceBound = false;
    }
}

private void createServiceConnection() {
    this.serviceConn = new ServiceConnection() {
        public void onServiceDisconnected(ComponentName name) {
            mainService = null;
            isServiceBound = false;
            Log.i("info", "Service disconnected.");
        }

        public void onServiceConnected(ComponentName name, IBinder service) {
            mainService = ((SocketService.SocketBinder) service)
                    .getService();
            isServiceBound = true;
            Log.i("info", "Service connected.");
        }
    };
}

And the Manifest definition of the service is:

  <service
        android:name="timesheetdb.Services.SocketService"
        android:exported="false"
        android:permission="normal" android:stopWithTask="true" android:enabled="true">
        <intent-filter>
            <action android:name="timesheetdb.Services.SocketService" />
        </intent-filter>
    </service>
  • 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-14T11:03:45+00:00Added an answer on June 14, 2026 at 11:03 am

    Here is a list of valid attributes for a service defintion

    http://developer.android.com/guide/topics/manifest/service-element.html
    

    You can try remove the permission and stopWithTask attributes from your service definition in the manifest.

    Let me know if that works

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

Sidebar

Related Questions

Alright, here we go! I am currently developing an iPhone app that will work
I am developing a web app that will have two parts running on two
I'm currently working on developing a custom keyboard app that will be optimized for
I am developing a web app (using rails) that I will be launching within
I'm developing an app that receive contente (URI) and I'm testing it with IE10
i'm developing an app that has a jtable and user could start a download.
I'm developing a web app that will show the location of a project in
I am developing an app that uses push notifications, and testing on a device
We are developing an ASP.NET MVC web app that will be hosted on Windows
Working on developing a Class for my android app that will randomly generate NPCs

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.