我试图执行 Firebase
云消息在我 application
,已经执行了所有 settings
使用此 service
,但当我试图延长 FirebaseMessagingService
在我的课我给出错误和它根本找不到它,我甚至不能 import com.google.firebase.messaging.FirebaseMessagingService
中所示 picture
:
我已经添加了所需的所有代码︰ 我都加入到应用程序 gradle
compile 'com.google.firebase:firebase-core:9.4.0'
apply plugin: 'com.google.gms.google-services'
和这对模块 gradle:
classpath 'com.google.gms:google-services:3.0.0'
这是 manifest
的代码︰
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
和我将谷歌 json 文件添加到应用程序。 所以如果有人可以帮我请
如果你想要使用消息传递,必须添加消息处理模块。现在您只添加了核心模块。
所以去吧包括
compile 'com.google.firebase:firebase-messaging:9.4.0'
所有可用的模块可以发现底部的https://firebase.google.com/docs/android/setup