GCM not waking up device

后端 未结 3 904
不思量自难忘°
不思量自难忘° 2021-02-20 00:27

I developing a GCM application. Everything works fine when the device is not idle (i.e. sleeping by pressing the power button). However, when I send the message when the device

相关标签:
3条回答
  • 2021-02-20 01:11

    delayWhileIdle=false

    delay_while_idle : If included, indicates that the message should not be sent immediately if the device is idle.
    The server will wait for the device to become active, and then only the last message for each *collapse_key* value will be sent. Optional. The default value is false, and must be a JSON boolean.

    0 讨论(0)
  • 2021-02-20 01:11

    Server side need this code;

        builder.delayWhileIdle(false);
    

    it's mean that no wake up phone on deep sleep. but received message.

    then when wake up user phone, generated new intent for GCMIntentService.

    0 讨论(0)
  • 2021-02-20 01:16

    problem within manifest file only.Make sure the following are the contents of manifest file GCM

    <permission
        android:name="packagename.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    
    <uses-permission android:name="packagename.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    
    <application>
        <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="packagename" />
            </intent-filter>
         </receiver>
         <service android:name=".GCMIntentService" android:enabled="true" />
    </application>
    
    0 讨论(0)
提交回复
热议问题