diff --git a/sdk/src/main/java/com/oursky/authgear/AuthgearCore.kt b/sdk/src/main/java/com/oursky/authgear/AuthgearCore.kt index ab7058ad..d5d4f35b 100644 --- a/sdk/src/main/java/com/oursky/authgear/AuthgearCore.kt +++ b/sdk/src/main/java/com/oursky/authgear/AuthgearCore.kt @@ -483,7 +483,11 @@ internal class AuthgearCore( } } } - application.registerReceiver(br, intentFilter) + if (Build.VERSION.SDK_INT >= 33) { + application.registerReceiver(br, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } else { + application.registerReceiver(br, intentFilter) + } application.startActivity( WebViewActivity.createIntent(application, action, authorizeUrl) ) diff --git a/sdk/src/main/java/com/oursky/authgear/CustomTabsUIImplementation.kt b/sdk/src/main/java/com/oursky/authgear/CustomTabsUIImplementation.kt index 14ce10f2..307f2c64 100644 --- a/sdk/src/main/java/com/oursky/authgear/CustomTabsUIImplementation.kt +++ b/sdk/src/main/java/com/oursky/authgear/CustomTabsUIImplementation.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.net.Uri +import android.os.Build import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException import kotlin.coroutines.suspendCoroutine @@ -54,7 +55,11 @@ class CustomTabsUIImplementation : UIImplementation { } } } - context.registerReceiver(br, intentFilter) + if (Build.VERSION.SDK_INT >= 33) { + context.registerReceiver(br, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } else { + context.registerReceiver(br, intentFilter) + } context.startActivity( OAuthActivity.createAuthorizationIntent( context, diff --git a/sdk/src/main/java/com/oursky/authgear/OAuthActivity.kt b/sdk/src/main/java/com/oursky/authgear/OAuthActivity.kt index 976f3b7c..0d724f9a 100644 --- a/sdk/src/main/java/com/oursky/authgear/OAuthActivity.kt +++ b/sdk/src/main/java/com/oursky/authgear/OAuthActivity.kt @@ -48,6 +48,7 @@ internal class OAuthActivity : AppCompatActivity() { intent.getStringExtra(KEY_BROADCAST_ACTION)?.let { broadcastAction -> val broadcastIntent = Intent(broadcastAction) + broadcastIntent.setPackage(this.applicationContext.packageName) broadcastIntent.putExtra(AuthgearCore.KEY_OAUTH_BOARDCAST_TYPE, OAuthBroadcastType.REDIRECT_URL.name) this.intent.data?.toString()?.let { broadcastIntent.putExtra(AuthgearCore.KEY_REDIRECT_URL, it) diff --git a/sdk/src/main/java/com/oursky/authgear/OAuthWebViewBaseActivity.kt b/sdk/src/main/java/com/oursky/authgear/OAuthWebViewBaseActivity.kt index 17a0107b..36c7e5e1 100644 --- a/sdk/src/main/java/com/oursky/authgear/OAuthWebViewBaseActivity.kt +++ b/sdk/src/main/java/com/oursky/authgear/OAuthWebViewBaseActivity.kt @@ -154,6 +154,7 @@ internal open class OAuthWebViewBaseActivity : AppCompatActivity() { private fun sendRedirectURLBroadcast() { intent.getStringExtra(KEY_BROADCAST_ACTION)?.let { broadcastAction -> val broadcastIntent = Intent(broadcastAction) + broadcastIntent.setPackage(this.applicationContext.packageName) broadcastIntent.putExtra(AuthgearCore.KEY_OAUTH_BOARDCAST_TYPE, OAuthBroadcastType.REDIRECT_URL.name) mResult?.data?.toString()?.let { broadcastIntent.putExtra(AuthgearCore.KEY_REDIRECT_URL, it) diff --git a/sdk/src/main/java/com/oursky/authgear/WebKitWebViewActivity.kt b/sdk/src/main/java/com/oursky/authgear/WebKitWebViewActivity.kt index a6622d8b..32e9f3d4 100644 --- a/sdk/src/main/java/com/oursky/authgear/WebKitWebViewActivity.kt +++ b/sdk/src/main/java/com/oursky/authgear/WebKitWebViewActivity.kt @@ -309,6 +309,7 @@ class WebKitWebViewActivity: AppCompatActivity() { this.intent.getStringExtra(KEY_BROADCAST_ACTION)?.let { broadcastAction -> val broadcastIntent = Intent(broadcastAction) + broadcastIntent.setPackage(this.applicationContext.packageName) broadcastIntent.putExtra(AuthgearCore.KEY_OAUTH_BOARDCAST_TYPE, OAuthBroadcastType.REDIRECT_URL.name) if (this.result != null) { broadcastIntent.putExtra(AuthgearCore.KEY_REDIRECT_URL, this.result.toString()) diff --git a/sdk/src/main/java/com/oursky/authgear/WebKitWebViewUIImplementation.kt b/sdk/src/main/java/com/oursky/authgear/WebKitWebViewUIImplementation.kt index d3813c4a..ab09e964 100644 --- a/sdk/src/main/java/com/oursky/authgear/WebKitWebViewUIImplementation.kt +++ b/sdk/src/main/java/com/oursky/authgear/WebKitWebViewUIImplementation.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.net.Uri +import android.os.Build import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException import kotlin.coroutines.suspendCoroutine @@ -55,7 +56,11 @@ class WebKitWebViewUIImplementation(val actionBarBackgroundColor: Int? = null, v } } } - context.registerReceiver(br, intentFilter) + if (Build.VERSION.SDK_INT >= 33) { + context.registerReceiver(br, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } else { + context.registerReceiver(br, intentFilter) + } val webViewOptions = WebKitWebViewActivity.Options(options.url, options.redirectURI) webViewOptions.actionBarBackgroundColor = this@WebKitWebViewUIImplementation.actionBarBackgroundColor webViewOptions.actionBarButtonTintColor = this@WebKitWebViewUIImplementation.actionBarButtonTintColor diff --git a/sdk/src/main/java/com/oursky/authgear/WebViewActivity.kt b/sdk/src/main/java/com/oursky/authgear/WebViewActivity.kt index 081318d1..58319106 100644 --- a/sdk/src/main/java/com/oursky/authgear/WebViewActivity.kt +++ b/sdk/src/main/java/com/oursky/authgear/WebViewActivity.kt @@ -115,6 +115,7 @@ internal class WebViewActivity : AppCompatActivity() { private fun sendEndBroadcast() { this.intent.getStringExtra(KEY_BROADCAST_ACTION)?.let { broadcastAction -> val broadcastIntent = Intent(broadcastAction) + broadcastIntent.setPackage(this.applicationContext.packageName) broadcastIntent.putExtra(KEY_BROADCAST_TYPE, BroadcastType.END.name) this.sendBroadcast(broadcastIntent) } diff --git a/sdk/src/main/java/com/oursky/authgear/app2app/App2App.kt b/sdk/src/main/java/com/oursky/authgear/app2app/App2App.kt index 5122d422..68ef8d33 100644 --- a/sdk/src/main/java/com/oursky/authgear/app2app/App2App.kt +++ b/sdk/src/main/java/com/oursky/authgear/app2app/App2App.kt @@ -117,7 +117,11 @@ internal class App2App( k.resume(Uri.parse(resultUri)) } } - application.registerReceiver(br, intentFilter) + if (Build.VERSION.SDK_INT >= 33) { + application.registerReceiver(br, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } else { + application.registerReceiver(br, intentFilter) + } application.startActivity(intent) } }