-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clicking on notification doesn't open Android app (remote push) #1806
Comments
I suggest you to take a look at Also check if there is no other Activity which could intercept the notification (before Regards, |
hi very fast reply tanks, but I do have the launchMode set up on manifest see below
my application his a simple webview notting else :(. Bres regard |
Unfortunately, without a reproducible exemple, I will not be able to help. You can refer to the exemple project. |
I have the same problem, notification shows up, but clicking on it make the notification disappear and not do anything, not open the app nothing. @Dallas62 got any leads to what it might be? I've tried all bunch of variations of AndroidManifest.xml etc. |
Unfortunately, without a reproducible exemple, I will not be able to help. You can refer to the exemple project. |
I can't share a full working example unfortunately, it's company owned code. It would be amazing if you can give me at least some leads. One thing that I've been trying is ripping out my Splash screen library, could that affect it? Here's my AndroidManifest.xml, do you spot any problems: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- START React Native Push Notifications !-->
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- END React Native Push Notifications !-->
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher"
android:allowBackup="false" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask" android:windowSoftInputMode="adjustResize">
<!-- Start Deeplinking !-->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="rbsports"/>
</intent-filter>
<!-- End Deeplinking !-->
</activity>
<!-- Start SplashScreen !-->
<activity android:name=".SplashActivity" android:theme="@style/SplashTheme" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- End SplashScreen !-->
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
<!-- Start React Native Push Notifications !-->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="Live Message Notifications"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="New messages"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" />
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@color/app_primary"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/app_primary" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- End React Native Push Notifications !-->
</application>
</manifest> The first thing I call in the App.js, is this function import PushNotification from 'react-native-push-notification'
import PushNotificationIOS from '@react-native-community/push-notification-ios'
import { FIREBASE_PROJECT_NUMBER } from '../config'
import { IS_ANDROID } from './device'
let deviceToken = null
export const initializePushNotifications = () => {
if (!IS_ANDROID) {
return null
}
return PushNotification.configure({
onRegister: async (token) => {
deviceToken = token
},
onNotification: notification => {
notification.finish(PushNotificationIOS.FetchResult.NoData)
},
senderID: FIREBASE_PROJECT_NUMBER,
requestPermissions: true
})
}
export const getDeviceToken = () => {
return deviceToken
} |
Can you share the file which is calling I need to see the call-stack, I guess it's call in a component which is the reason of the issue. |
You can also try this solution: |
This is import 'react-native-get-random-values'
import 'react-native-gesture-handler'
import { AppRegistry } from 'react-native'
import App from './src/index'
AppRegistry.registerComponent('MyApp', () => App) Then in import { initialize as initializeSentry } from './utils/sentry'
import React, { useState } from 'react'
import ErrorBoundary from './components/ErrorBoundary/ErrorBoundary'
import Error from './screens/Error/Error'
import AuthLoader from './components/AuthLoader/AuthLoader'
import SplashScreenLoader from './components/SplashScreenLoader/SplashScreenLoader'
import Main from './components/Main/Main'
import * as Sentry from '@sentry/react-native'
import SessionContext from './contexts/session'
import useProvideSession from './hooks/useProvideSession'
import { StatusBar } from 'react-native'
import { initializeGetStreamPushNotifications } from './utils/pushNotifications'
initializeGetStreamPushNotifications() // HERE IT GETS CALLED
initializeSentry()
const ignoredSentryTouchEventsNames = [
'Provider'
]
const App = () => {
const [error, setError] = useState(null)
const session = useProvideSession()
const handleError = error => {
setError(error)
Sentry.captureException(error)
}
if (error) {
return <Error />
}
return (
<Sentry.TouchEventBoundary ignoreNames={ignoredSentryTouchEventsNames}>
<StatusBar
backgroundColor='transparent'
translucent
barStyle='light-content'
/>
<ErrorBoundary onError={handleError}>
<SessionContext.Provider value={session}>
<AuthLoader />
<SplashScreenLoader />
<Main />
</SessionContext.Provider>
</ErrorBoundary>
</Sentry.TouchEventBoundary>
)
}
export default App |
Already tried, notifications are correctly received, but clicking on them doesn't make anything happen |
And did you tried the snippet bellow ? package com.chatium.app;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
// Pass along FCM messages/notifications etc.
Bundle extras = getIntent().getExtras();
if (extras != null) {
intent.putExtras(extras);
}
startActivity(intent);
finish();
}
} |
Jup tried that, nothing, this is the behaviour I see: |
Hi! I have faced this problem and tried all the possible solutions. As it turned out, there was a problem with a remote notification. We use node-pushnotifications for this purpose. There is a field I know that it is a special case but hope it will help someone |
@anna-kryva thanks for sharing, we're using GetStream as push notifications this is the data they send out: {
"body": "{{ sender.name }} has posted a new message",
"click_action": "OPEN_ACTIVITY_1",
"sound": "default"
} |
@mikevercoelen I recommend you to look at this issue which is the same kind of issue with Batch provider. (#1801) |
@mikevercoelen Try adding this intent-filter to your AndroidManifest nested inside of <activity android:name=".MainActivity"...
|
In case somebody still lands here: For me the problem only occurred on Android 13 and was fixed by updating firebase sdk and google play services to the latest versions. |
Indeed ! Works for me |
Hi,
i have a problem with push notifications, when the application is closed or running in the background, when i receive a push notification, clicking on it does not open the application. however when the application is open and has focus, the click seems to reload the application. Do you have any idea what might be causing this problem?
Sincerely
The text was updated successfully, but these errors were encountered: