File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
xkcd/src/proprietary/java/xyz/jienan/xkcd Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ buildscript {
1212 dependencies {
1313 classpath ' com.android.tools.build:gradle:4.0.2'
1414 if (isProprietary) {
15- classpath ' com.google.gms:google-services:4.3.3 '
16- classpath ' com.google.firebase:firebase-crashlytics-gradle:2.1.1 '
15+ classpath ' com.google.gms:google-services:4.3.4 '
16+ classpath ' com.google.firebase:firebase-crashlytics-gradle:2.3.0 '
1717 classpath " com.tencent.mm:AndResGuard-gradle-plugin:1.2.18"
1818 }
1919 classpath " io.objectbox:objectbox-gradle-plugin:$objectboxVersion "
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ package xyz.jienan.xkcd
33import android.app.Application
44import com.google.android.gms.common.ConnectionResult
55import com.google.android.gms.common.GoogleApiAvailability
6+ import com.google.android.gms.tasks.OnCompleteListener
67import com.google.firebase.crashlytics.FirebaseCrashlytics
8+ import com.google.firebase.iid.FirebaseInstanceId
79import com.google.firebase.messaging.FirebaseMessaging
810import timber.log.Timber
911import java.util.*
12+ import kotlin.concurrent.thread
1013
1114object FlavorUtils {
1215
@@ -19,6 +22,22 @@ object FlavorUtils {
1922 subscribeToTopic(FCM_TOPIC_NEW_COMICS )
2023 subscribeToTopic(FCM_TOPIC_NEW_WHAT_IF )
2124 }
25+ if (BuildConfig .DEBUG ) {
26+ thread(start = true ) {
27+ Timber .d(" FCM id ${FirebaseInstanceId .getInstance().id} " )
28+ }
29+
30+ FirebaseMessaging .getInstance().token.addOnCompleteListener(OnCompleteListener { task ->
31+ if (! task.isSuccessful) {
32+ Timber .w(task.exception, " Fetching FCM registration token failed" )
33+ return @OnCompleteListener
34+ }
35+
36+ // Get new FCM registration token
37+ val token = task.result
38+ Timber .d(" FCM token $token " )
39+ })
40+ }
2241 }
2342
2443 fun updateLocale () {
You can’t perform that action at this time.
0 commit comments