Chi*_*mar 26 android firebase firebase-cloud-messaging
我在Android中使用Firebase云消息传递(FCM)API进行推送通知.当我实施那个时间完美的工作,但现在它找不到谷歌播放的服务.
错误是:
FirebaseInstanceId:后台同步失败:SERVICE_NOT_AVAILABLE,
请帮我解决一下.我在gradle文件中使用了以下依赖项.
dependencies {
compile files('libs/ksoap2-android-assembly-3.4.0-jar.jar')
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/gson-2.2.4.jar')
compile files('libs/activation.jar')
compile files('libs/mail.jar')
compile files('libs/additionnal.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.14.0'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile('com.google.android.gms:play-services:9.0.2') {
exclude group: "play-services-wallet"
exclude module: "play-services-wallet"
exclude group: "play-services-ads"
exclude module: "play-services-ads"
}
}
Run Code Online (Sandbox Code Playgroud)
感谢您抽时间阅读.
小智 14
sus*_*vi 12
你可以检查一下
google-service.json的新的,你可以在firebaseconsol得到它经过长时间的努力,我找到了答案,如果谷歌播放服务没有运行然后FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE日志打印,那么你可以检查你的谷歌播放服务运行是否正常?
可能这些信息对您有所帮助!
该服务需要绑定到 Manifest.xml
<!-- Firebase InstanceId Service -->
<service
android:name="eu.acme.service.FireBaseInstanceIdService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
那么一个人就可以访问一种公开的方法(其他名称被混淆=不可靠):
package eu.acme.service;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class FireBaseInstanceIdService extends FirebaseInstanceIdService {
@Override
@android.support.annotation.WorkerThread
public void onTokenRefresh() {
/* obtain the current InstanceId token: */
String token = FirebaseInstanceId.getInstance().getToken();
}
}
Run Code Online (Sandbox Code Playgroud)
一个人只能解决它,而不激怒它。通过不加入任何AuthState听众在明知没有活动的网络存在,如解释在这里 -因为它似乎,一个否则无法赶上从库中抛出的异常-这可以忽略不计,因为它仅仅只是抱怨,有没有网络连接。
com.google.android.gms.iid和com.google.firebase.iid大致相同。
| 归档时间: |
|
| 查看次数: |
36464 次 |
| 最近记录: |