Android: Can't get push notification when app is off
See original GitHub issueIm able to get push notification when app is on or in background, but then app is off with task manager I didn’t get nothing
When I try to use only FCM dashboard Im getting it even if app is off
android/app/build.grandle
compile(project(':react-native-fcm')) {
exclude group: "com.google.firebase"
}
compile ('com.google.firebase:firebase-core:11.+') {
force = true;
}
compile ('com.google.firebase:firebase-messaging:11.+') {
force = true;
}
compile('io.intercom.android:intercom-sdk-base:4.+') {
force = true;
}
compile('io.intercom.android:intercom-sdk-fcm:4.+') {
force = true;
}
AndroidManifest.xml
<application
android:name="io.bla.bla.MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"
xmlns:tools="http://schemas.android.com/tools">
.....
<service
android:name="com.robinpowered.react.Intercom.IntercomIntentService"
android:exported="false">
<intent-filter
android:priority="999">
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<receiver
android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
tools:replace="android:exported"
android:exported="true" />
</application>
permisions from AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12
Top Results From Across the Web
Push Notifications when app is closed - android - Stack Overflow
In Android 8.0 Oreo if the application is closed, then notification is not received It is because of DOZE mode and battery optimization,you...
Read more >Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >Android device cannot receive push notifications when an ...
Android device cannot receive push notifications when an application is force stopped ("killed") · Go to Settings > Apps & Notifications > enable ......
Read more >Android push notification not working when the app is closed
So the situation is like, all are getting the notification as per their custom modification done in the app but some devices are...
Read more >How to Fix Notifications Not Showing up on Android - Lifewire
Cause of Notifications Not Showing up on Android · Do Not Disturb or Airplane Mode is on. · Either system or app notifications...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@akyker20 I am using intercom in my project and able to get push notification. I am taking help from react-native-firebase. What I did was created a CustomFCMMessageService.java in same directory where mainApplication.java is present.
`package com.xxx.xxx;
import java.util.Map; import android.util.Log; import com.google.firebase.messaging.RemoteMessage; import com.webengage.sdk.android.WebEngage; import io.invertase.firebase.messaging.RNFirebaseMessagingService; import io.intercom.android.sdk.push.IntercomPushClient;
public class CustomFCMMessageService extends RNFirebaseMessagingService { private static final String TAG = “CustomFCMMessageService”;
}
` I am using Firebase messaging service to detect push notification.
then in AndroidManifest.xml
add this
<service android:name=".CustomFCMMessageService" // replacing firebase messaging service as suggested by doc android:enabled="true" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service>
Hope this will help 😃
@tobob It seems that you’re using the action for GCM. try to replace with
<action android:name="com.google.firebase.MESSAGING_EVENT"/>