4.1다음 내 응용 프로그램에 푸시 알림을받을 수 없습니다 해요 4.1
< 내가 KITKAT 4.4.4 실행하는 실제 장치가 안드로이드 실행 이전 버전에 설치 내 애플 리케이션에 안드로이드 GCM 메시지를받을 수 없습니다 및 괜찮아요,하지만 오래된 장치 (예 : 펌웨어 2.3.6)로 작동하지 않습니다 ... 나는 4.0.4에서도 운없이 테스트했습니다.
서버에서 등록하고 등록을 취소 할 수 있지만 RegistrationID를 올바르게 얻지 만 서버에서 이전 장치로 푸시 알림을 트리거 할 때 아무런 문제가 발생하지 않습니다.
내가 로그에서 볼 수있는 유일한 메시지는 다음과 같습니다
W/GTalkService﹕ [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.metu.tracker.app] (has extras) }
내가 아래에있는 내 구성을 게시, 그래서 당신은 코드를 볼 수 있습니다.
package com.metu.tracker.app;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
/**
* Created by metu on 28/08/14.
*/
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GCMIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
int FLAG_INCLUDE_STOPPED_PACKAGES = 32;
intent.addFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
이 내 서비스 : 이것은 내 수신기입니다
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.metu.tracker.app" >
<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission to save in external storage for image save (avatar) -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Permission to get fine coordinate -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- Permission to open the gallery and modify photos -->
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Permission to get MAPS -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.metu.tracker.app.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.metu.tracker.app.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Permission GCM -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.metu.tracker.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.metu.tracker.gcm.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver
android:name=".GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.metu.tracker.app" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
<activity
android:name="com.metu.tracker.app.MainActivity"
android:label="@string/app_name"
android:noHistory="true">
...
:
이
내 매니페스트입니다 내가 유래 이미 볼public class GCMIntentService extends GCMBaseIntentService {
public GCMIntentService() {
super(SENDER_ID);
}
/**
* Method called on device registered
**/
@Override
protected void onRegistered(Context context, String registrationId) {
Log.i(TAG, "Device registered: regId = " + registrationId);
//displayMessage(context, "Your device registred with GCM");
//Log.d("NAME", MainActivity.name);
ServerUtilities.register(context, registrationId);
}
/**
* Method called on device un registred
* */
@Override
protected void onUnregistered(Context context, String registrationId) {
//Log.i(TAG, "Device unregistered");
displayMessage(context, getString(R.string.gcm_unregistered));
ServerUtilities.unregister(context, registrationId);
}
/**
* Method called on Receiving a new message
* */
@Override
protected void onMessage(Context context, Intent intent) {
Log.i(TAG, "Received message");
String message = intent.getExtras().getString("message");
displayMessage(context, message);
// notifies user
generateNotification(context, message);
// Release the wake lock provided by the WakefulBroadcastReceiver.
GcmBroadcastReceiver.completeWakefulIntent(intent);
...
, 유용한있다 이 오류에 대한 정보가 있지만 그것을 해결하는 방법을 알아낼 수 없습니다. 나는 도움이 필요해.
감사합니다.