question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Xiaomi didn't receive notification on killed although enable autostart in miui

See original GitHub issue

This behavior is Xiaomi only (tested to MIUI 8). When I test on other non-Xiaomi devices, it has no problem.

I already enable autostart on my app, add “lock” to app, enable app notification, and restart device. But it still didn’t receive notification. But other apps like WhatsApp is receive notification although it has been killed. Maybe the problem is on react-native-fcm itself?

This is my AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.foobar"
    xmlns:tools="http://schemas.android.com/tools"
    android:versionCode="1"
    android:versionName="1.0">

  ...

    <!-- compatible with tab -->
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <!-- /compatible with tab -->

    <!-- react-native-fcm -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <!-- /react-native-fcm -->

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

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

      <!-- react-native-fcm -->
      <service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
        <intent-filter>
          <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
      </service>

      <service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false">
        <intent-filter>
          <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
      </service>

      <receiver android:name="com.evollu.react.fcm.FIRLocalMessagingPublisher" />
      <receiver android:enabled="true" android:exported="true" android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver">
        <intent-filter>
          <action android:name="android.intent.action.BOOT_COMPLETED"/>
          <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
          <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
          <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
      </receiver>
      <!-- /react-native-fcm -->

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait"
        android:launchMode="singleTask"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- react-native-fcm -->
        <intent-filter>
          <action android:name="fcm.ACTION.HELLO" />
          <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <!-- /react-native-fcm -->
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rohitliencommented, Apr 20, 2018

You could try auto start feature of mi.

2reactions
luisfuertescommented, Mar 13, 2018

I have this issue. Xiaomi Redmi 5a and Redmi 4X push doesnt work with app closed. (With app in bg all works fine).

Some suggest to fix it?

PD: If on xiaomi phone go to Security>Permissions>Autostart and allow your app to autostart all works fine

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix MIUI push notifications - Android Central
Tap Autostart. Choose the apps that aren't sending push notifications. Toggle the slider to ensure the apps always start in the background.
Read more >
How To Fix Push Notifications On Xiaomi's MIUI 8, For Real
2: Go to settings --> permissions --> autostart. From there, pick the apps you want to receive notifications, and toggle the switch to...
Read more >
Xiaomi | Don't kill my app!
When you open the recent apps tray, drag your app downwards (it will be locked). So, even if you clear recent apps, it...
Read more >
Xiaomi does not receive notification when application is not ...
If we want to receive notification if application is killed then we need to allow auto restart app manually from security app of...
Read more >
MIUI Killing Apps : r/Xiaomi - Reddit
Some of my apps even when I enabled their autostart, set their battery ... However, some later, it's permanent notification will just ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found