2
며칠 동안 Google 클라우드 메시징 API를 배웠으며 현재 애플리케이션에 오류가 있습니다. 첫째, 나는 PHP에 의해 내 서버를 구축하고 그러한 여기로 GCM에 대한 성공 메시지를 반환 브로드 캐스트 수신기가 Google 클라우드 메시징을 수신 할 수 없습니다.
{"multicast_id":7148194663931263470,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1413222862155080%099070adf9fd7ecd"}]}
하지만 내 응용 프로그램에서
, 난 내 응용 프로그램이 메시지를 받게됩니다 있는지 확인하기 위해 많은 방법을 시도해야합니다. 그러나 나는 실패한다. 내 신청서에 어떤 것도 접수되지 않았습니다.누군가 나를 돕습니다. 여기
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dangchienhsgs.giffus" >
<permission
android:name="com.dangchienhsgs.giffus.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.dangchienhsgs.giffus.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HomeActivity"
android:label="@string/title_activity_home" >
</activity>
<receiver
android:name=".GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.dangchienhsgs.giffus" />
</intent-filter>
</receiver>
<provider
android:name=".provider.DataProvider"
android:authorities="com.dangchienhsgs.giffus.provider"
android:exported="false" >
</provider>
<service android:name=".GcmIntentService"/>
<activity
android:name=".RegisterActivity"
android:label="@string/title_activity_register" >
</activity>
<!--<service android:name=".account.AuthenticatorService" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service> -->
</application>
</manifest>
이 GCMBroadcastReceiver.java
package com.dangchienhsgs.giffus;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.gcm.GoogleCloudMessaging;
public class GCMBroadcastReceiver extends WakefulBroadcastReceiver {
private static final String TAG="GCMBroadcastReceiver";
@Override
public void onReceive(Context context, Intent intent) {
// Sure that GCMIntentService will handle the intent
Log.d(TAG, "is Received");
Log.d(TAG, "Our message is received");
ComponentName comp=new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
여기
내 Github에서 링크입니다 : "https://github.com/dangchienhsgs/Giffus는"
예, 내가했다. 여기에 내 github 링크가 있습니다 : https://github.com/dangchienhsgs/Giffus 나를 확인할 수 있습니까? Google APIS – user251047
으로 어려움을 겪고 있습니다. 내 애플리케이션이 사용자 이름과 비밀번호로 로그인 할 수 있기를 바랍니다. 사용자가 자신의 계정에 로그인 할 때마다 등록 ID를 등록하도록합니다. 또한 내 서버로 업데이트합니다. 뭔가 잘못 됐어? – user251047
코드를 읽고 모든 것이 정상적으로 처리 된 것 같습니다. 서버가 오른쪽 (마지막) ID를 얻으면 각 로그인에 ID를 등록하는 것이 문제가되지 않아야합니다. 나는 안드로이드에서 모든 것이 괜찮다고 생각한다. 그래서 서버없이 디버깅을 시도 할 수 있습니다. [Rest UI client] (https://code.google.com/p/rest-client/downloads/detail?name=restclient-ui-3.2.2-jar-with-dependencies.jar&can=2&q=)를 사용합니다. 등록 ID를 얻고이 프로그램에서 POST 요청을 작성하십시오. 요청 파일은 다음과 같습니다. http://www.speedyshare.com/PKYpD/gcm.rcq – vzoha