BaijnathG / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Not allowed to bind to service Intent #397

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

check out the code using 
hg clone https://mytracks.googlecode.com/hg/ mytracks

1.Import MyTracks project into workspace
2.Import MyTracks Lib into your project as a lib.
3.bind the service in the onCreate method of your activity

Intent intent = new Intent();
        intent.setComponent(new ComponentName(
                getString(R.string.mytracks_service_package),
                getString(R.string.mytracks_service_class)));
      this.bindService(intent, mConnection, 
            Context.BIND_AUTO_CREATE);

4.Defining the mConnection ServiceConnection outside your onCreate()
private ITrackRecordingService mytracksService;

private ServiceConnection mConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName className,
                IBinder service) {
             mytracksService = ITrackRecordingService.Stub.asInterface(service);       
        }

        @Override
        public void onServiceDisconnected(ComponentName arg0) {

        }
    };

What is the expected output? What do you see instead?
Expected Output:The onServiceConnected function in the mConnection object 
should get called and the ITrackRecordingService variable should be set to the 
IBinder variable passed to 
onServiceConnected.

Actual Output:The bindService throws an  exception, and onServiceConnected 
never gets called.
java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.mytracks/com.mytracks.Testing}: java.lang.SecurityException: 
Not allowed to bind to service Intent { 
cmp=com.google.android.maps.mytracks/com.google.android.apps.mytracks.services.T
rackRecordingService }

What version of MyTracks are you using? On what version of Android? On what
phone?

I am using MyTracks Version v1.1.3. I am working on android version 2.2.I am 
using LGP500 

If possible please provide a log.  Either upload here or send to mytracks-
support@google.com.
Detailed instructions can be found here:
http://code.google.com/p/mytracks/wiki/HowToReportErrors

Please provide any additional information here:
I have checked out the issue which had the same problem and that was fixed 
using android:exported using 'true' in Mytracks manifest.
That's not the case here.Please correct me if there's something wrong in my 
code.

Original issue reported on code.google.com by rogers9...@gmail.com on 17 Mar 2011 at 11:07

Attachments:

GoogleCodeExporter commented 9 years ago
Can you attach your AndroidManifest.xml? Please double-check that your app is 
requesting the appropriate permission to use the service.

Original comment by rdama...@google.com on 17 Mar 2011 at 12:23

GoogleCodeExporter commented 9 years ago
Here's the Androidmanifest.xml

Original comment by rogers9...@gmail.com on 17 Mar 2011 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago
I think <uses-permission> should be outside the <application> tag. Can you 
confirm if changing this helps?

Original comment by rdama...@google.com on 17 Mar 2011 at 9:45

GoogleCodeExporter commented 9 years ago
My bad.Yes it does help.Thanks for correcting me.

Original comment by rogers9...@gmail.com on 18 Mar 2011 at 5:26

GoogleCodeExporter commented 9 years ago

Original comment by sandordo...@google.com on 18 Mar 2011 at 5:35