我發展我的Android應用程序推送通知。在這一點上:ActivityNotFoundException在谷歌雲端通訊
if (checkPlayServices()){
Intent intent = new Intent(this, RegistrationIntentService.class);
startActivity(intent);
}
設備必須進行註冊以獲得令牌,並將其發送到服務器,但是當我試圖啓動活動的代碼崩潰。下面是在logcat中所示的錯誤:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cgp.tpvtablet/com.cgp.tpvtablet.activity.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.cgp.tpvtablet/com.cgp.tpvtablet.area_push.notification.RegistrationIntentService}; have you declared this activity in your AndroidManifest.xml?
清單中的RegistrationIntentService聲明爲在其目前的包裝服務:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustPan">
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.cgp.tpvtablet"/>
</intent-filter>
</receiver>
<service android:name=".area_push.notification.MyGCMListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service android:name=".area_push.notification.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<service android:name=".area_push.notification.RegistrationIntentService"
android:exported="false"/>
</application>
編輯建議我這條道路時,我在寫RegistrationIntentService表現。 任何人都可以幫助我嗎?提前致謝。
包是:com.nvp.testapp – Viherbar