Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native : Error: [messaging/unknown] java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: FIS_AUTH_ERROR

I am trying to implement the push notification in my app. I have used react-native-firebase/app and @react-native-firebase/messaging libraries for the push notification. i have follow the complete document and try to implement push notification. But I have showing this error getting push token Error: [messaging/unknown] java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: FIS_AUTH_ERROR.

Code:

import React, {Fragment, useEffect} from 'react';
import {StyleSheet, View, Text, Button} from 'react-native';
import messaging from '@react-native-firebase/messaging';

//1
const checkPermission = () => {
  messaging()
    .hasPermission()
    .then((enabled) => {
      if (enabled) {
        getToken();
      } else {
        requestPermission();
      }
    })
    .catch((error) => {
      console.log('error checking permisions ' + error);
    });
};

//2
const requestPermission = () => {
  messaging()
    .requestPermission()
    .then(() => {
      getToken();
    })
    .catch((error) => {
      console.log('permission rejected ' + error);
    });
};

//3
const getToken = () => {
  messaging()
    .getToken()
    .then((token) => {
      console.log('push token ' + token);
    })
    .catch((error) => {
      console.log('error getting push token ' + error);
    });
};

const Notification = () => {
  useEffect(() => {
    checkPermission();
    messaging().setBackgroundMessageHandler(async (remoteMessage) => {
      console.log('Message handled in the background!', remoteMessage);
    });

    
  });
  
  return (
    <View style={styles.container}>
      <Text>Push Notification</Text>
     
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  button: {
    margin: 10,
  },
});

export default Notification;
like image 525
vjtechno Avatar asked Aug 16 '26 20:08

vjtechno


1 Answers

I have the same issue, you can try this solution: open the React Native project by Android Studio, look at the toolbar and select Build -> Clean Project after that click Run app (^R or control + r on Macbook). It's working for me.

like image 65
Việt Xuân Avatar answered Aug 18 '26 09:08

Việt Xuân



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!