Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import React, {Component} from "react";
  2. import PushNotification from "react-native-push-notification";
  3. // var PushNotification = require("react-native-push-notification");
  4.  
  5. export default class PushController extends Component{
  6. componentDidMount(){
  7. PushNotification.configure({
  8. // (optional) Called when Token is generated (iOS and Android)
  9. onRegister: function(token) {
  10. console.log("TOKEN:", token);
  11. },
  12.  
  13. // (required) Called when a remote or local notification is opened or received
  14. onNotification: function(notification) {
  15. console.log("NOTIFICATION:", notification);
  16.  
  17. // process the notification here
  18.  
  19. // required on iOS only
  20. notification.finish(PushNotificationIOS.FetchResult.NoData);
  21. },
  22. // Android only
  23. senderID: "1090501687137",
  24. // iOS only
  25. permissions: {
  26. alert: true,
  27. badge: true,
  28. sound: true
  29. },
  30. popInitialNotification: true,
  31. requestPermissions: true
  32. });
  33. }
  34.  
  35. render(){
  36. return null;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement