I have two apps, one runs in namespace com.gtosoft.voyager and the other is com.gtosoft.dash. From com.gtosoft.dash I would like to start up the service which is defined in com.gtosoft.voyager...
I think I need an intent, but what arg(s) would I pass to the intent before kicking it off with startService()?
If they were in the same package I could just use
Intent svc=new Intent (SettingsActivity.this,VoyagerService.class);
startService(svc);
Snippet of Manifest which defines the service
<application android:icon="@drawable/voyagercarlogo" android:label="@string/app_name" android:debuggable="false">
<provider android:name="com.gtosoft.voyager.VoyagerCProvider"
android:authorities="com.gtosoft.voyager"/>
<service android:name=".VoyagerService"/>
<activity android:name=".SettingsActivity"
android:label="Voyager"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I would set up an
<intent-filter>
on the service, with a custom action, and then use it in yourIntent
to start or bind to that service. You can see an example of that in this pair of client and service sample projects.While CommonsWare's answer was correct back in April of 2010, things have a changed and you need to actually setComponent to start a service in another application. For instance,
Activity in com.xyz.app1: