evollu / evollu/react-native-fcm

FCM Object functions not working while sending push notifications

Open
#1,035 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.7k
Forks
661
PR merge metrics
No merged PRs in 30d

Description

I am using this module for push notifications in my react-native app using firebase cloud messaging service.
I follow up this module example simple-fcm-client but i had implemented code for it but it is not working.

**Problem:** when i starts my app i check out with console that i have the correct FCM object with me but found that the function FCM.createNotificationChannel not working. Means the code doesn't works out from the FCM.createNotificationChannel function even if any normal console line is written next to this function block and also no error comes from the step the function of notification channel is called.

**Expected:** Please help me for properly executing the push notifications implementation in my react-native app using fcm with fcm registered token for the android ios device.

**RN(React Native) Version 0.55.2
react-native-fcm Version 16.2.0
Device using Android 7 device
Android CompileSDKVersion = 26
Android TargetSDKVersion = 26
AndroidMinSDKVersion = 16
Java Version 8
Windows 7
App running either in foreground or background but the FCM Object functions usage neither works out nor gives any error.**

**===========build.gradle file==================**
buildToolsVersion = "26.0.3"
minSdkVersion = 16
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.0.0-alpha1"

**=================React Native Code===============**
import FCM, {FCMEvent, RemoteNotificationResult, WillPresentNotificationResult, NotificationType, NotificationActionType, NotificationActionOption, NotificationCategoryOption} from "react-native-fcm";

` async **componentDidMount**() {

registerAppListener();
console.warn(FCMEvent); // complete object is printed in console output
console.warn(FCM); // complete object is printed in console output

FCM.createNotificationChannel({ // Not working No result
id: 'aa',
name: 'aa',
description: 'used for example',
priority: 'max'
});

FCM.getInitialNotification().then(notif => { // Not working No result
this.setState({
initNotif: notif
});
if (notif && notif.targetScreen === "detail") {
setTimeout(() => {
this.props.navigation.navigate("Detail");
}, 500);
}
});

try {
let result = await FCM.requestPermissions(); // Not working No result
} catch (e) {
console.warn(e);
}

FCM.getFCMToken().then(token => { // Not working No result
console.warn("TOKEN (getFCMToken)", token);
this.setState({ token: token || "" });
});

if (Platform.OS === "ios") {
FCM.getAPNSToken().then(token => { // Not working No result
console.warn("APNS TOKEN (getFCMToken)", token);
});
}

}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.