Skip to content

Instantly share code, notes, and snippets.

@ShaileshPrajapati-BTC
Last active May 25, 2017 11:42
Show Gist options
  • Save ShaileshPrajapati-BTC/ce072e816e4be5cd888879160990fb18 to your computer and use it in GitHub Desktop.
Save ShaileshPrajapati-BTC/ce072e816e4be5cd888879160990fb18 to your computer and use it in GitHub Desktop.
import React,{Component} from 'react';
import FCM from "react-native-fcm";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
fcm_token: ""
};
}
componentDidMount () {
FCM.requestPermissions();
FCM.getFCMToken().then(token => {
this.setState({fcm_token:token});
//update your fcm token on server.
});
}
render() {
return (
<View>
<Text>FCM Setup</Text>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment