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>
Now my app in xiaomi can receive notification although has been killed. I can't figure out why, but what I've done is just praying, and now it's work :smile:
I solved this problem with Xiaomi Red Note 4X by disabling "Don't keep activities" in the developer option. I don't remember why it was set enabled in the first place.
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
You could try auto start feature of mi.
i have this issue,auto start does not work!
Most helpful comment
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