2013-12-23 61 views
0

我按照說明,但當我測試發送消息,我沒有收到任何東西。PushBot Android客戶端不工作

應用程序中沒有錯誤,並且pushbot控制檯發現存在已註冊的設備。

我如何知道發生了什麼?

該代碼非常類似模板,並遵循它們提供的所有說明。

應用

import com.pushbots.push.Pushbots; 
import android.app.Application; 

public class MyApplication extends Application { 
    @Override 
    public void onCreate() { 



     super.onCreate(); 
     String SENDER_ID = "ID here"; 
     String PUSHBOTS_APPLICATION_ID = "Pushbot App Id"; 
     Pushbots.init(this, SENDER_ID,PUSHBOTS_APPLICATION_ID); 
    } 
} 

清單如下所示

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.zuppush" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <!-- GCM connects to Google Services. --> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
<!-- GCM requires a Google account. --> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 

<permission android:name="com.example.zuppush.permission.C2D_MESSAGE" 
    android:protectionLevel="signature" /> 
<uses-permission android:name="com.example.zuppush.permission.C2D_MESSAGE" /> 

<!-- This app has permission to register and receive data message. --> 
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 




    <uses-sdk 
     android:minSdkVersion="14" 
     android:targetSdkVersion="17" /> 


     <application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:name="com.example.zuppush.MyApplication" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 


     <activity 
      android:name="com.example.zuppush.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 


      <intent-filter> 
      <action android:name="com.example.zuppush.MESSAGE" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 

     </activity> 


     <activity android:name="com.pushbots.push.PBMsg"/> 
<activity android:name="com.pushbots.push.PBListener"/> 
<receiver 
android:name="com.google.android.gcm.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.example.zuppush" /> 
    </intent-filter> 
</receiver> 
<receiver android:name="com.pushbots.push.MsgReceiver" /> 
<service android:name="com.pushbots.push.GCMIntentService" /> 
<service android:name="org.openudid.OpenUDID_service" > 
    <intent-filter> 
     <action android:name="org.openudid.GETUDID" /> 
    </intent-filter> 
</service> 


    </application> 

</manifest> 

回答

0

我不知道你正在使用其中com.google.android.gcm.GCMBroadcastReceiver版本,但如果是從舊的客戶端採取的默認實現GCM庫,此實現預計GCMIntentService將位於您的應用程序的主包(com.example.zuppush)中,情況並非如此。

+0

那麼這是環繞GCM的pushbot服務。但是我認爲這是一個使用pushbot的bug。我沒有改變任何這個代碼,但在開始新項目之後,我終於重新開始工作。 – drlobo