简体   繁体   English

Firebase多个应用程序风味未调用相同的google-services.json文件onTokenRefresh()

[英]Firebase multiple app flavors same google-services.json file onTokenRefresh() not called

I have an application having multiple product flavors sharing the same google-services.json file. 我有一个具有多种产品口味的应用程序,它们共享同一个google-services.json文件。 My problem is I have checked everything and my implementation is right but I am not able to get the callback for this class in my app 我的问题是我检查了所有内容,并且实现正确,但是无法在我的应用中获取此类的回调

public class FirebaseTokenRegister extends FirebaseInstanceIdService {

@Override
public void onTokenRefresh() {
    String refreshedToken = FirebaseInstanceId.getInstance().getToken();
    Log.d("TAG", "Refreshed token: " + refreshedToken);
    FirebaseMessaging.getInstance().subscribeToTopic("phoenix");
    Logger.d(FirebaseInstanceId.getInstance().getToken());
    Toast.makeText(Base.getContext(), refreshedToken, Toast.LENGTH_SHORT).show();
}

} }

I have set this class in manifest also 我也在清单中设置了该类

    <service android:name=".model.firebase.FirebaseTokenRegister"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

    <service android:name=".model.firebase.FireBaseMessageNotify"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

I have checked everything again and again but the method onTokenRefresh() is not called anyhow. 我已经一遍又一遍地检查了所有内容,但是无论如何都没有调用onTokenRefresh()方法。 I have tried installing and uninstalling the app. 我尝试安装和卸载该应用程序。 Now i am having a doubt that wether it's the right way to implement the product flavors sharing the same google-services.json file? 现在,我怀疑这是否是实现共享相同google-services.json文件的产品风味的正确方法?

Please help 请帮忙

The error was I was having 错误是我有

 <application
    android:name=".AppController"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="${appIcon}"
    node="replace"
    android:label="${flavored_app_name}"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

This was causing problems in manifest merging so this was resolved after changing. 这在清单合并中引起了问题,因此在更改后得以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将多种产品口味和口味尺寸组合在一起时,缺少文件google-services.json - File google-services.json is missing when combining multiple product flavors with flavor dimensions 具有多个项目的 Firebase google-services.json? - Firebase google-services.json with multiple projects? Firebase google-services.json文件 - Firebase google-services.json file google-services.json在创建我的应用程序的产品样式时导致问题,可能的解决方法? - google-services.json causing problems in creating product flavors of my app, possible fix? 对于某些产品口味,有没有办法没有google-services.json? - Is there any way to have no google-services.json for some of product flavors? 使用Firebase注册应用-“ google-services.json”文件和“ build.cradle”文件 - Registering the app with firebase - “google-services.json” file and “build.cradle” file 无法从 Firebase 控制台下载 google-services.json 文件 - Unable to download google-services.json file from Firebase Console Firebase-更改文件名google-services.json? - Firebase - Changing file name google-services.json? 适用于Firebase和Google Analytics(分析)的google-services.json - google-services.json for Firebase and Google Analytics 多种口味/ applicationId可以使用相同的google-services.json吗? - Can multiple flavours/applicationId use the same google-services.json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM