Commit 24c29f39 authored by Libin Lu's avatar Libin Lu

picture example

parent 2ed1c1b5
...@@ -33,7 +33,8 @@ export default class App extends Component { ...@@ -33,7 +33,8 @@ export default class App extends Component {
title: 'Hello', title: 'Hello',
body: 'Test Notification', body: 'Test Notification',
priority: "high", priority: "high",
show_in_foreground: true show_in_foreground: true,
picture: 'https://firebase.google.com/_static/af7ae4b3fc/images/firebase/lockup.png'
}); });
} }
......
...@@ -48,34 +48,23 @@ export default class PushController extends Component { ...@@ -48,34 +48,23 @@ export default class PushController extends Component {
notif.finish(WillPresentNotificationResult.All) //other types available: WillPresentNotificationResult.None notif.finish(WillPresentNotificationResult.All) //other types available: WillPresentNotificationResult.None
break; break;
} }
} }
this.showLocalNotification(notif);
});
this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, token => {
console.log("TOKEN (refreshUnsubscribe)", token);
this.props.onChangeToken(token);
});
// direct channel related methods are ios only this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, token => {
// directly channel is truned off in iOS by default, this method enables it console.log("TOKEN (refreshUnsubscribe)", token);
FCM.enableDirectChannel(); this.props.onChangeToken(token);
this.channelConnectionListener = FCM.on(FCMEvent.DirectChannelConnectionChanged, (data) => { });
console.log('direct channel connected' + data);
});
setTimeout(function() {
FCM.isDirectChannelEstablished().then(d => console.log(d));
}, 1000);
}
showLocalNotification(notif) { // direct channel related methods are ios only
FCM.presentLocalNotification({ // directly channel is truned off in iOS by default, this method enables it
title: notif.title, FCM.enableDirectChannel();
body: notif.body, this.channelConnectionListener = FCM.on(FCMEvent.DirectChannelConnectionChanged, (data) => {
priority: "high", console.log('direct channel connected' + data);
click_action: notif.click_action, });
show_in_foreground: true setTimeout(function() {
}); FCM.isDirectChannelEstablished().then(d => console.log(d));
}, 1000);
})
} }
componentWillUnmount() { componentWillUnmount() {
......
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