Skip to content

Commit 1fcc5db

Browse files
authored
Merge pull request #9 from segment-integrations/add-receiver-not-exported
fix: add RECEIVER_NOT_EXPORTED when registering a broadcast receiver.
2 parents 380c864 + 012e7be commit 1fcc5db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/main/java/com/segment/analytics/kotlin/consent/onetrust/OneTrustConsentChangedNotifier.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.content.Context
55
import android.content.Intent
66
import android.content.IntentFilter
77
import android.util.Log
8+
import androidx.core.content.ContextCompat
89
import com.onetrust.otpublishers.headless.Public.Keys.OTBroadcastServiceKeys
910
import com.segment.analytics.kotlin.consent.ConsentManager
1011
import java.lang.ref.WeakReference
@@ -26,9 +27,11 @@ class OneTrustConsentChangedNotifier(
2627
categories.forEach {
2728

2829
if (context != null) {
29-
context.registerReceiver(
30+
ContextCompat.registerReceiver(
31+
context,
3032
OneTrustConsentChangedReceiver(consentPlugin),
31-
IntentFilter(OTBroadcastServiceKeys.OT_CONSENT_UPDATED)
33+
IntentFilter(OTBroadcastServiceKeys.OT_CONSENT_UPDATED),
34+
ContextCompat.RECEIVER_NOT_EXPORTED
3235
)
3336
}
3437
}

0 commit comments

Comments
 (0)