Closed canerd7u closed 4 years ago
same issue for me
hai i have same issue, @evollu any update for this problem ?
@dedenhendrap , @edritech93
`{ "to":"".state['kullanici_fcm_token']."", "data":{ "sound":"default", "priority":"high", "show_in_foreground":true, "content_available":true, "bildirim_ref":"user",
}, "notification":{ "title":"Satış İzni", "body":" $title ", "content_available":true }, "priority":10 }`
use same json with remote notification. for me success.
i have project in react navigation and i want use push notification send post request.
my app.js
`import React ,{ Component } from "react"; import { View, Text , Button , Platform , TextInput } from "react-native"; import { createStackNavigator, createAppContainer } from "react-navigation";
import FCM, { FCMEvent, WillPresentNotificationResult, NotificationType, } from "react-native-fcm";
import firebaseClient from "./FirebaseClient";
class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { const {navigate} = this.props.navigation; return ( <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
}
FCM.on(FCMEvent.Notification, notif => { console.log("Bildirim geldi", notif);
});
FCM.getInitialNotification().then(notification => { console.log("notification" , notification); });
// eğer token yenilenirse çalışır FCM.on(FCMEvent.RefreshToken, token => { console.log("TOKEN YENİLENDİ (refreshUnsubscribe)", token); });
// Uygulamaya Push atmak için izin alıyoruz try { FCM.requestPermissions({badge: false, sound: true, alert: true}); } catch(e){ console.error(e); }
// Firebase Cloud Message Token değerini getirir. FCM.getFCMToken().then(token => { console.log("TOKEN (getFCMToken)", token); global.token = token; });
if(Platform.OS === 'ios') { // Eğer APNS istiyorsanız isteğe bağlı APNS TOKEN FCM.getAPNSToken().then(token => { console.log("APNS TOKEN (getAPNSToken)", token); }); }
class TwoScreen extends React.Component {
}
const AppNavigator = createStackNavigator({ Home: { screen: HomeScreen } , TwoHome: { screen: TwoScreen } });
export default createAppContainer(AppNavigator);`