@@ -11,11 +11,13 @@ import re.notifica.push.ktx.INTENT_ACTION_ACTION_OPENED
11
11
import re.notifica.push.ktx.INTENT_ACTION_LIVE_ACTIVITY_UPDATE
12
12
import re.notifica.push.ktx.INTENT_ACTION_NOTIFICATION_OPENED
13
13
import re.notifica.push.ktx.INTENT_ACTION_NOTIFICATION_RECEIVED
14
+ import re.notifica.push.ktx.INTENT_ACTION_SUBSCRIPTION_ID_CHANGED
14
15
import re.notifica.push.ktx.INTENT_ACTION_SYSTEM_NOTIFICATION_RECEIVED
15
16
import re.notifica.push.ktx.INTENT_ACTION_TOKEN_CHANGED
16
17
import re.notifica.push.ktx.INTENT_ACTION_UNKNOWN_NOTIFICATION_RECEIVED
17
18
import re.notifica.push.ktx.INTENT_EXTRA_DELIVERY_MECHANISM
18
19
import re.notifica.push.ktx.INTENT_EXTRA_LIVE_ACTIVITY_UPDATE
20
+ import re.notifica.push.ktx.INTENT_EXTRA_SUBSCRIPTION_ID
19
21
import re.notifica.push.ktx.INTENT_EXTRA_TOKEN
20
22
import re.notifica.push.models.NotificareLiveActivityUpdate
21
23
import re.notifica.push.models.NotificareNotificationDeliveryMechanism
@@ -25,11 +27,16 @@ import re.notifica.push.models.NotificareUnknownNotification
25
27
public open class NotificarePushIntentReceiver : BroadcastReceiver () {
26
28
override fun onReceive (context : Context , intent : Intent ) {
27
29
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
+ }
28
34
Notificare .INTENT_ACTION_TOKEN_CHANGED -> {
29
35
val token: String = requireNotNull(
30
36
intent.getStringExtra(Notificare .INTENT_EXTRA_TOKEN )
31
37
)
32
38
39
+ @Suppress(" DEPRECATION" )
33
40
onTokenChanged(context, token)
34
41
}
35
42
Notificare .INTENT_ACTION_NOTIFICATION_RECEIVED -> {
@@ -85,6 +92,16 @@ public open class NotificarePushIntentReceiver : BroadcastReceiver() {
85
92
}
86
93
}
87
94
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
+ )
88
105
protected open fun onTokenChanged (context : Context , token : String ) {
89
106
NotificareLogger .debug(
90
107
" The push token changed, please override onTokenChanged if you want to receive these intents."
0 commit comments