GCM notification does not receive when app is killed (does not kill force)

I happily get notifications when the app is in the background and foreground, but when the app is killed, I don't get notifications on some phones (e.g. Xiaomi phone models like mi3, etc.).

GCM message 0: 1434141725194227% 03b66390f9fd7ecd call broadcast: result = CANCEL forIntent {act = com.google.android.c2dm.intent.RECEIVE pkg = (has additional features)}

Though I get notifications on other phones like nexus, samsung, others. Has anyone had a similar problem? Can someone explain to me where I am going wrong.

Here is my manifest file

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

<permission android:name="<package_name>.permission.C2D_MESSAGE" android:protectionLevel="signature"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="<package_name>.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />

<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>
<action android:name="android.net.wifi.STATE_CHANGE"/>


<application
    android:name="<package_name>.ApplicationSingleton"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity
        android:name="<package_name>.ui.activity.ReferralActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">

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


    <receiver
        android:name="<package_name>.gcm.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="<package_name>" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
            <category android:name="<package_name>"/>
        </intent-filter>

    </receiver>

    <service android:name="<package_name>.gcm.GcmIntentService" />

    </activity>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />


</application>

      

+3


source to share


1 answer


Autostart is probably the best MIUI feature that isn't enabled by default but should.

What does autorun do? It basically launches the apps you choose when you start your phone, so you never miss any notifications or updates.

To enable autostart applications, follow these steps:

  • Tap on the Security app on the app screen.


You won't find this if you go to the Settings menu, you need to click directly on the app icon.

Open security app: Open Security App

  1. In the Security app, click Permissions.

  2. Click on autoplay

  3. Toggle the apps you want to enable autoplay for

  4. Reboot your phone.

You are now configured with autorun!

0


source







All Articles