This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { useEffect } from 'react'; | |
| import { | |
| onNotificationReceivedInForeground, | |
| onNotificationReceivedInBackground, | |
| onNotificationOpened, | |
| getLaunchNotification, | |
| } from 'aws-amplify/push-notifications'; | |
| import {Alert} from 'react-native'; | |
| export const useNotificationListener = () => { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { useEffect, useState } from 'react'; | |
| import { | |
| onTokenReceived, | |
| OnTokenReceivedInput, | |
| OnTokenReceivedOutput, | |
| } from 'aws-amplify/push-notifications'; | |
| export const useToken = () => { | |
| const [token, setToken] = useState<string>(''); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { useState, useEffect } from 'react'; | |
| import { | |
| getPermissionStatus, | |
| requestPermissions, | |
| } from 'aws-amplify/push-notifications'; | |
| export type PushNotificationPermissionStatus = | |
| | 'denied' | |
| | 'granted' | |
| | 'shouldRequest' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <!-- Required permissions for push notifications --> | |
| <uses-permission android:name="android.permission.INTERNET" /> | |
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
| <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
| <uses-permission android:name="android.permission.WAKE_LOCK" /> | |
| <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> | |
| <uses-permission android:name="android.permission.VIBRATE" /> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { AppRegistry } from 'react-native'; | |
| import App from './App'; | |
| import { name as appName } from './app.json'; | |
| import { Amplify } from 'aws-amplify'; | |
| import { initializePushNotifications } from 'aws-amplify/push-notifications'; | |
| import amplifyconfig from './src/amplifyconfiguration.json'; | |
| Amplify.configure(amplifyconfig); | |
| initializePushNotifications(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // index.js | |
| // ... | |
| import { initializePushNotifications } from 'aws-amplify/push-notifications'; | |
| initializePushNotifications(); | |
| // ... | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | npm install aws-amplify @aws-amplify/react-native @aws-amplify/rtn-push-notification @react-native-async-storage/async-storage react-native-get-random-values | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | apply plugin: 'com.google.gms.google-services' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | classpath 'com.google.gms:google-services:4.4.2' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React from 'react'; | |
| import Main from './src/Main.tsx'; | |
| const App = () => { | |
| return <Main />; | |
| }; | |
| export default App; | 
NewerOlder