无法接收来自Firebase云消息传递的推送通知

时间:2019-02-23 14:37:16

标签: firebase react-native firebase-cloud-messaging react-native-android

嘿,我是反应本机和射击基地的初学者。我正在尝试从Firebase云消息传递中获得推送通知,但是通过android模拟器

可以发现的错误很少

1.E / FirebaseInstanceId:无法解析目标意图服务,跳过了类名强制实施

2.E / FirebaseInstanceId:传递消息时出错:找不到ServiceIntent。

3.E / FirebaseInstanceId:令牌检索失败:SERVICE_NOT_AVAILABLE

4.E / FirebaseInstanceId:令牌检索失败:SERVICE_NOT_AVAILABLE

5.E / StrictMode:com.google.android.maps.MapsActivity类;实例= 2; limit = 1 android.os.StrictMode $ InstanceCountViolation:类com.google.android.maps.MapsActivity;实例= 2;限制= 1 在android.os.StrictMode.setClassInstanceLimit

AndroidMainfest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

App.js

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';

const instructions = Platform.select({
 ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
 android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
render() {
 return (
   <View style={styles.container}>
    <Text style={styles.welcome}>Welcome to React Native!</Text>
    <Text style={styles.instructions}>To get started, edit     App.js</Text>
    <Text style={styles.instructions}>{instructions}</Text>
  </View>
);
}

}

const styles = StyleSheet.create({
 container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

0 个答案:

没有答案