tamtoum1987
tamtoum1987

Reputation: 2057

how use firebase android for multiple id application

I have an application that is different for each user, id application is different for each user, so idApplication is dynamic. My problem is that json retrieved from firebase is linked to a single application id. How can I use one file json for all the applications I generate dynamically?

_______édit ____

I don't know thé application id, this application id is modified on a filé jenkins.properties on my project Android, and when jenkins générate New apk it do it with thé New id

Upvotes: 1

Views: 343

Answers (1)

John O'Reilly
John O'Reilly

Reputation: 10330

Instead of relying on google-services.json and associated gradle plugin you can dynamically create FirebaseApp using something like following (I have this in dagger module)

    FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
            .setApiKey(apiKey)
            .setApplicationId(someApplicationId)
            .setDatabaseUrl(databaseUrl)
            .setStorageBucket(storageBucket)
            .build();

    firebaseApp = FirebaseApp.initializeApp(context, firebaseOptions, "MyApp");

Upvotes: 2

Related Questions