diff --git a/Examples/simple-fcm-client/app/App.js b/Examples/simple-fcm-client/app/App.js index a571e2807fce8663ee0bbfbc22ce083bf947fbd8..4fe5669f5281eba11851a86b56caaeaaa4491a0b 100644 --- a/Examples/simple-fcm-client/app/App.js +++ b/Examples/simple-fcm-client/app/App.js @@ -28,6 +28,14 @@ export default class App extends Component { } } + componentDidMount(){ + FCM.getInitialNotification().then(notif => { + this.setState({ + initNotif: notif + }) + }); + } + showLocalNotification() { FCM.presentLocalNotification({ vibrate: 500, @@ -39,6 +47,19 @@ export default class App extends Component { }); } + scheduleLocalNotification() { + FCM.scheduleLocalNotification({ + id: 'testnotif', + fire_date: new Date().getTime()+5000, + vibrate: 500, + title: 'Hello', + body: 'Test Scheduled Notification', + priority: "high", + show_in_foreground: true, + picture: 'https://firebase.google.com/_static/af7ae4b3fc/images/firebase/lockup.png' + }); + } + render() { let { token, tokenCopyFeedback } = this.state; @@ -51,6 +72,11 @@ export default class App extends Component { Welcome to Simple Fcm Client! + + Init notif: {JSON.stringify(this.state.initNotif)} + + + this.setClipboardContent(this.state.token)} style={styles.instructions}> Token: {this.state.token} @@ -74,6 +100,10 @@ export default class App extends Component { this.showLocalNotification()} style={styles.button}> Send Local Notification + + this.scheduleLocalNotification()} style={styles.button}> + Schedule Notification in 5s + ); }