尝试构建一个将从服务器接收推送通知的gcm应用程序。但是当我在模拟器或真实设备上执行代码时,这就是我在LogCat上获得的内容
I/===GCMIntentService===(6977): Device registered: regId = reg number here
V/GCMBaseIntentService(6977): Releasing wakelock
V/GCMBroadcastReceiver(6977): onReceive: com.google.android.c2dm.intent.REGISTRATION
V/GCMBroadcastReceiver(6977): GCM IntentService class: com.my.app.GCMIntentService
V/GCMBaseIntentService(6977): Acquiring wakelock
V/GCMBaseIntentService(6977): Intent service name: GCMIntentService-303034343665-2
D/GCMBaseIntentService(6977): handleRegistration: registrationId = null, error = null, unregistered = com.my.app
D/GCMRegistrar(6977): resetting backoff for com.my.app
V/GCMRegistrar(6977): Saving regId on app version 2
D/dalvikvm(6977): GC_FOR_ALLOC freed 247K, 12% free 3168K/3580K, paused 29ms, total 34ms
I/===GCMIntentService===(6977): unregistered = reg number here
V/GCMBaseIntentService(6977): Releasing wakelock
任何人都可以帮助我!
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<!-- 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="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.my.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.my.app.permission.C2D_MESSAGE" />
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.my.app" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />