launch service from different package
android, launch, service
Solution
Use this in your manifest:
<service
android:name=".service.MyService"
android:enabled="true" />
Make sure your are using correct `package name` for `service` in `manifest` file. If `MyService.java` file is in `com.idris.activity.service` package than use:
<service android:name="com.idris.activity.service.MyService" />
Problem
I trying to make a project, I have one activity and one service from diferent package. The both package I put in one project. I put the activity in : com.idris.activity, and I put the Service in : com.idris.activity.service I try to call MyService from a button's listener in MyActivity like this : ``` Intent myIntent = new Intent(getApplicationContext(), MyService.class); myIntent.putExtra("extraData", "somedata"); startService(myIntent); ``` application's manifest ``` <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="idris.parental.monitor" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".MyActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <service android:name=".MyService" android:enabled="true" /> </application> </manifest> ``` MyService can't launch, what shuld I do?