Skip to content

Commit

Permalink
Code CleanUp
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacakakpo1 committed Jan 15, 2025
1 parent f02b20a commit 0df722a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs-markdown/push-notification/app-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,23 @@ You are now ready to receive push notifications via Firebase Messaging Service.
android:name=".ForegroundService"
android:foregroundServiceType="phoneCall"
android:exported="true" />
```
```
### Handling Missed Call Notifications
The backend sends a missed call notification when a call is ended while the socket is not yet connected. It comes with the `Missed call!` message. In order to handle missed call notifications, you can use the following code snippet in the FirebaseMessagingService class:
``` kotlin
const val Missed_Call = "Missed call!"
val params = remoteMessage.data
val objects = JSONObject(params as Map<*, *>)
val metadata = objects.getString("metadata")
val isMissedCall: Boolean = objects.getString("message").equals(Missed_Call) //

if(isMissedCall){
Timber.d("Missed Call")
val serviceIntent = Intent(this, NotificationsService::class.java).apply {
putExtra("action", NotificationsService.STOP_ACTION)
}
serviceIntent.setAction(NotificationsService.STOP_ACTION)
startMessagingService(serviceIntent)
return
}
```

0 comments on commit 0df722a

Please sign in to comment.