<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<permission android:name="com.illudia.karwan_e_quran.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.illudia.karwan_e_quran.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive dataf message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.illudia.karwan_e_quran.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.illudia.karwan_e_quran.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
这是我的MainActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Pushbots.sharedInstance().init(this);
Pushbots.sharedInstance().setPushEnabled(true);}
这是我的logcat 03-02 18:27:44.531:I / PB2(12107):PushBots Library v2.0.9AS 03-02 18:27:44.541:V / PB2(12107):com.illudia.kaarwanequraan的接收器数量:2 03-02 18:27:44.541:V / PB2(12107):找到1个动作接收器com.google.android.c2dm.intent.REGISTRATION 03-02 18:27:44.541:V / PB2(12107):找到1个动作接收器com.google.android.c2dm.intent.RECEIVE 03-02 18:27:44.561:V / PB2(12107):在服务器上注册:true
答案 0 :(得分:1)
似乎这不是你的完整清单。确保您的清单包含设置默认推送接收器类的部分。
<receiver
android:name="com.pushbots.google.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.sampleapp" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.push.DefaultPushHandler" />
<service android:name="com.pushbots.push.GCMIntentService" />
<service android:name="org.openudid.OpenUDID_service" android:exported="false">
<intent-filter>
<action android:name="org.openudid.GETUDID" />
</intent-filter>
</service>