プロジェクトを作成しようとしていますが、異なるパッケージから 1 つのアクティビティと 1 つのサービスがあります。私が1つのプロジェクトに入れた両方のパッケージ。
アクティビティを com.idris.activity に配置し、サービスを com.idris.activity.service に配置しました。
次のように、MyActivity のボタンのリスナーから MyService を呼び出そうとします。
Intent myIntent = new Intent(getApplicationContext(), MyService.class);
myIntent.putExtra("extraData", "somedata");
startService(myIntent);
アプリケーションのマニフェスト
<?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 を起動できません。どうすればよいですか?