My home automatization project had been built on Android Things. It runs still OK. It contains, among others, also a ability to send FCM messages and some data manipulations in Firebase database and storage.
Due to Google migration from the Legacy HTTP API to v1 I need the short-lived access token generation and here the issue starts.
I read the very brief document on the migration. It turns out to me there is no Android library supporting the token access?
The Java code snippet refers to the Google Auth Library . I tried to use it in the Android project , but it seems to clash with the already implemented Firebase libraries used in the project(to access Firebase functions), the code build fails with an error: Duplicate class found.
Since the old Server key and the legacy API will be sunset I need to find the way to easily replace the legacy FCM code and the only thing missing now is how to obtain the tokens in the existing project without setting up another separate special messaging server .
Any recommendation how to obtain the FCM access tokens to authorize the send request for the Android project which has the Firebase libraries implemented (aka core,crashlytics,analytics,database, storage and FB auth libraries)? Or how to remove the error of the duplicate classes after trying to implement the recommended java library for Google Auth? Using the legacy HTTP API method worked fine due to static server key usage and no further libraries....
Thanks
used dependencies:
implementation 'com.loopj.android:android-async-http:1.4.11'
implementation 'com.google.auth:google-auth-library-oauth2-http:1.18.0'
implementation 'com.google.firebase:firebase-crashlytics:18.3.7'
implementation 'com.google.firebase:firebase-analytics:21.3.0'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-database:20.2.2'
implementation 'com.google.firebase:firebase-auth:22.0.0'
implementation 'com.google.firebase:firebase-storage:20.2.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
compileOnly 'com.google.android.things:androidthings:+'
testImplementation 'junit:junit:4.13.2'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.things.contrib:driver-button:1.0'
implementation 'org.tensorflow:tensorflow-lite:1.13.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
The issue of duplicity comes with adding the implementation 'com.google.auth:google-auth-library-oauth2-http:1.18.0'