Commit 90d0265c authored by Libin Lu's avatar Libin Lu

fix example

parent 98939636
......@@ -10,7 +10,8 @@ import {
Text,
TouchableOpacity,
View,
Clipboard
Clipboard,
Platform
} from 'react-native';
import FCM from "react-native-fcm";
......@@ -157,15 +158,15 @@ export default class App extends Component {
Remote notif won't be available to iOS emulators
</Text>
<TouchableOpacity onPress={() => firebaseClient.sendRemoteNotification(token)} style={styles.button}>
<TouchableOpacity onPress={() => this.sendRemoteNotification(token)} style={styles.button}>
<Text style={styles.buttonText}>Send Remote Notification</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => firebaseClient.sendRemoteData(token)} style={styles.button}>
<TouchableOpacity onPress={() => this.sendRemoteData(token)} style={styles.button}>
<Text style={styles.buttonText}>Send Remote Data</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => firebaseClient.sendRemoteNotificationWithData(token)} style={styles.button}>
<TouchableOpacity onPress={() => this.sendRemoteNotificationWithData(token)} style={styles.button}>
<Text style={styles.buttonText}>Send Remote Notification With Data</Text>
</TouchableOpacity>
......
import FirebaseConstants from "./FirebaseConstants";
import { Platform, Alert } from "react-native";
import { Alert } from "react-native";
const API_URL = "https://fcm.googleapis.com/fcm/send";
class FirebaseClient {
constructor() {
this.sendData = this.sendData.bind(this);
this.sendNotification = this.sendNotification.bind(this);
this.sendNotificationWithData = this.sendNotificationWithData.bind(this);
}
async send(body, type) {
if(FirebaseClient.KEY === 'YOUR_API_KEY'){
Alert.alert('Set your API_KEY in app/FirebaseConstants.js')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment