J'ai un service MyService.java dans l'application "ServiceDemo". Le manifeste de cette application se présente comme suitComment exécuter un service distant
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.moto.dev"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Sample"
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:enabled="true"
android:name=".MyService"
android:permission="syh.permission.STARTMYSERVICE">
</service>
</application>
<permission
android:protectionLevel="normal"
android:label="Start My Receiver"
android:description="@string/startMyActivityDesc"
android:name="syh.permission.STARTMYSERVICE">
</permission>
<uses-sdk android:minSdkVersion="8" />
</manifest>
J'ai une autre application « CallerService » ressemble manifeste comme celui-ci
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.moto.dev"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".CallerService"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="syh.permission.STARTMYSERVICE"></uses-permission>
<uses-sdk android:minSdkVersion="8" />
"src/com/moto/dev/Sample.java"</manifest>
j'ai une activité d'où je suis en train de démarrer le service sur le clic de le bouton
Intent intent = new Intent();
//path where my service is located in application "ServiceDemo"
intent.setClassName("com.moto.dev","com.moto.dev.MyService");
startService(intent);
Cela ne fonctionne pas. Dit "incapable de commencer l'intention de service" Puis-je savoir où je me trompe.