Я пытаюсь реализовать push-уведомление в своем приложении. Я использовал библиотеки response-native-firebase/app и @react-native-firebase/messaging для push-уведомлений. Я следую всему документу и пытаюсь реализовать push-уведомление. Но я показываю эту ошибку Ошибка получения push-токена: [messaging/unknown] java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: FIS_AUTH_ERROR.Код:
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 (
Push Notification
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
button: {
margin: 10,
},
});
export default Notification;
Подробнее здесь: https://stackoverflow.com/questions/680 ... il-concurr
React Native: Ошибка: [обмен сообщениями/неизвестно] java.io.IOException: java.util.concurrent.ExecutionException: java. ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение