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.
The SDK is free and open source (MIT) on GitHub. Create a free account to get your App ID.
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
The SDK is published on JitPack: add the JitPack repository and the dependency:
Gradle (Kotlin DSL)// settings.gradle.kts dependencyResolutionManagement { repositories { google() mavenCentral() maven("https://jitpack.io") } } // app/build.gradle.kts plugins { id("com.google.gms.google-services") // Firebase } dependencies { implementation("com.github.DaoChiMinh:tingpush-sdk:1.1.1") }Requires minSdk 23. 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() TingPush.init( this, appId = "YOUR_APP_ID", options = TingPush.Options( notificationIcon = R.drawable.ic_notification, callTexts = CallTexts(answer = "Answer", decline = "Decline"), ), ) TingPush.listener = object : TingPushListener { 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) { } // User tapped a notification (even when the app was closed) override fun onNotificationOpened(notification: TingPushNotification) { // navigate using notification.data["screen"]... } // Notification received while the app is open override fun onNotificationReceived(notification: TingPushNotification) { } } } } // AndroidManifest.xml: <application android:name=".App" ...>Main activity
MainActivity.ktclass MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) TingPush.requestNotificationPermission(this) // Android 13+ TingPush.handleIntent(intent) // opened from a notification / Answer tapped } override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) TingPush.handleIntent(intent) } }Assign the user at login
KotlinTingPush.login("user-123") // after login TingPush.logout() // on logout TingPush.setTags(mapOf("plan" to "vip")) TingPush.endCall(callId) // dismiss the ringing screenJava:
TingPush.init(...),TingPush.login(...),TingPush.INSTANCE.setListener(...).Reliable call ringing
Kotlin// "Call settings" screen in your app if (!TingPush.canUseFullScreenIntent(this)) { TingPush.openFullScreenIntentSettings(this) // Android 14+ } if (!TingPush.isIgnoringBatteryOptimizations(this)) { TingPush.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
[TingPush] 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.