Я выполнил настройку, используя официальную документацию Firebase
https://firebase.google.com/ docs/cloud-messaging
Раньше он работал как исключенный, и токен генерировался, приходило уведомление. Но за последние два дня я столкнулся с проблемой SERVICE_NOT_AVAILABLE, токен не генерируется, а тема не подписывается.
Ниже приведены мои настройки для FCM:
Код: Выделить всё
build.gradle(Project level)
Код: Выделить всё
buildscript {
dependencies {
classpath("com.google.gms:google-services:4.3.15")
}
}
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
}
Код: Выделить всё
build.gradle (app level)
Код: Выделить всё
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
dependencies{
implementation 'com.google.firebase:firebase-messaging-ktx:23.1.2'
implementation platform('com.google.firebase:firebase-bom:32.0.0')
implementation 'com.google.firebase:firebase-analytics'
}
До этой проблемы вся настройка работала.Я столкнулся с ошибкой:
Код: Выделить всё
E/FirebaseMessaging: Topic sync or token retrieval failed on hard failure exceptions: java.util.concurrent.ExecutionException: java.io.IOException: SERVICE_NOT_AVAILABLE. Won't retry the operation.
E/FirebaseMessaging: Failed to sync topics. Won't retry sync. java.util.concurrent.ExecutionException: java.io.IOException: SERVICE_NOT_AVAILABLE
E/Token Details: Token generation failed
java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: SERVICE_NOT_AVAILABLE
Подробнее здесь: https://stackoverflow.com/questions/791 ... ging-token