Android Push Notifications in Kotlin (FCM)
Kotlin/Java, minSdk 23. Firebase Cloud Messaging with a ready-made full-screen call UI.
🤖 Android
Kotlin/Java, minSdk 23. Firebase Cloud Messaging with a ready-made full-screen call UI.
Download the SDK from the dashboard (Integration guide) after you create a free account.
Set up Firebase
- Create an Android app in the Firebase Console and put
google-services.jsonin theapp/folder. - In TingPush: upload the service account JSON of that same Firebase project.
- Create an Android app in the Firebase Console and put
Add the SDK module
Unzip the download into your project's root folder (this creates
PushConsoleSDK/) and declare the module:Gradle (Kotlin DSL)// settings.gradle.kts include(":pushconsole") project(":pushconsole").projectDir = file("PushConsoleSDK/android/pushconsole") // app/build.gradle.kts plugins { id("com.google.gms.google-services") // Firebase } dependencies { implementation(project(":pushconsole")) }Requires minSdk 23 and Kotlin 2.x. With AGP 9's built-in Kotlin, remove the
id("org.jetbrains.kotlin.android")line inpushconsole/build.gradle.kts. Permissions, the FCM service and the call screen are declared in the SDK — no manifest changes needed.Initialize in Application
Initialize and set the listener in
Application.onCreateso no event is missed when the app is woken up from a closed state.App.ktclass App : Application() { override fun onCreate() { super.onCreate() PushConsole.init( this, appId = "YOUR_APP_ID", serverUrl = "https://tingpush.com", options = PushConsole.Options( notificationIcon = R.drawable.ic_notification, callTexts = CallTexts(answer = "Answer", decline = "Decline"), ), ) PushConsole.listener = object : PushConsoleListener { override fun onCallAccepted(call: CallInfo) { // User tapped Answer → connect the call (call.id, call.data["room"]) } override fun onCallDeclined(call: CallInfo) { } override fun onCallMissed(call: CallInfo) { } override fun onCallEnded(callId: String) { } override fun onNotificationOpened(data: Map<String, String>) { // navigate using data["screen"]... } } } } // AndroidManifest.xml: <application android:name=".App" ...>Main activity
MainActivity.ktclass MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) PushConsole.requestNotificationPermission(this) // Android 13+ PushConsole.handleIntent(intent) // opened from a notification / Answer tapped } override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) PushConsole.handleIntent(intent) } }Assign the user at login
KotlinPushConsole.login("user-123") // after login PushConsole.logout() // on logout PushConsole.setTags(mapOf("plan" to "vip")) PushConsole.endCall(callId) // dismiss the ringing screenJava:
PushConsole.init(...),PushConsole.login(...),PushConsole.INSTANCE.setListener(...).Reliable call ringing
Kotlin// "Call settings" screen in your app if (!PushConsole.canUseFullScreenIntent(this)) { PushConsole.openFullScreenIntentSettings(this) // Android 14+ } if (!PushConsole.isIgnoringBatteryOptimizations(this)) { PushConsole.openBatteryOptimizationSettings(this) // Xiaomi, Oppo, Vivo… }Xiaomi, Oppo, Vivo, Realme: guide users to enable Autostart and turn off battery optimization (as WhatsApp does).
✅ After integrating, check
- Run the app on a real device with logging on: you should see
[PushConsole] Device registered …. - The project's Devices tab: the device appears; iOS devices show the VoIP badge if you use calls.
- The Send tab: send a test to that device.
- Choose 📞 Call and test with the app open, closed and with the screen locked.