@@ -11,11 +11,13 @@ import re.notifica.push.ktx.INTENT_ACTION_ACTION_OPENED
1111import re.notifica.push.ktx.INTENT_ACTION_LIVE_ACTIVITY_UPDATE
1212import re.notifica.push.ktx.INTENT_ACTION_NOTIFICATION_OPENED
1313import re.notifica.push.ktx.INTENT_ACTION_NOTIFICATION_RECEIVED
14+ import re.notifica.push.ktx.INTENT_ACTION_SUBSCRIPTION_ID_CHANGED
1415import re.notifica.push.ktx.INTENT_ACTION_SYSTEM_NOTIFICATION_RECEIVED
1516import re.notifica.push.ktx.INTENT_ACTION_TOKEN_CHANGED
1617import re.notifica.push.ktx.INTENT_ACTION_UNKNOWN_NOTIFICATION_RECEIVED
1718import re.notifica.push.ktx.INTENT_EXTRA_DELIVERY_MECHANISM
1819import re.notifica.push.ktx.INTENT_EXTRA_LIVE_ACTIVITY_UPDATE
20+ import re.notifica.push.ktx.INTENT_EXTRA_SUBSCRIPTION_ID
1921import re.notifica.push.ktx.INTENT_EXTRA_TOKEN
2022import re.notifica.push.models.NotificareLiveActivityUpdate
2123import re.notifica.push.models.NotificareNotificationDeliveryMechanism
@@ -25,11 +27,16 @@ import re.notifica.push.models.NotificareUnknownNotification
2527public open class NotificarePushIntentReceiver : BroadcastReceiver () {
2628 override fun onReceive (context : Context , intent : Intent ) {
2729 when (intent.action) {
30+ Notificare .INTENT_ACTION_SUBSCRIPTION_ID_CHANGED -> {
31+ val subscriptionId = intent.getStringExtra(Notificare .INTENT_EXTRA_SUBSCRIPTION_ID )
32+ onSubscriptionIdChanged(context, subscriptionId)
33+ }
2834 Notificare .INTENT_ACTION_TOKEN_CHANGED -> {
2935 val token: String = requireNotNull(
3036 intent.getStringExtra(Notificare .INTENT_EXTRA_TOKEN )
3137 )
3238
39+ @Suppress(" DEPRECATION" )
3340 onTokenChanged(context, token)
3441 }
3542 Notificare .INTENT_ACTION_NOTIFICATION_RECEIVED -> {
@@ -85,6 +92,16 @@ public open class NotificarePushIntentReceiver : BroadcastReceiver() {
8592 }
8693 }
8794
95+ protected open fun onSubscriptionIdChanged (context : Context , subscriptionId : String? ) {
96+ NotificareLogger .debug(
97+ " The subscription id changed, please override onSubscriptionIdChanged if you want to receive these intents."
98+ )
99+ }
100+
101+ @Deprecated(
102+ message = " Use onSubscriptionIdChanged() instead." ,
103+ replaceWith = ReplaceWith (" onSubscriptionIdChanged(context, subscriptionId)" )
104+ )
88105 protected open fun onTokenChanged (context : Context , token : String ) {
89106 NotificareLogger .debug(
90107 " The push token changed, please override onTokenChanged if you want to receive these intents."
0 commit comments