Skip to content

Conversation

@endmr11
Copy link

@endmr11 endmr11 commented Oct 4, 2024

Android 12 and later (API 31 and above): The RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED flag has become mandatory in these versions. If BroadcastReceiver will only be used within the application, Context.RECEIVER_NOT_EXPORTED is used. If exporting is required, Context.RECEIVER_EXPORTED can be used.

…EIVER_NOT_EXPORTED flag has become mandatory in these versions. If BroadcastReceiver will only be used within the application, Context.RECEIVER_NOT_EXPORTED is used. If it needs to be exported, Context.RECEIVER_EXPORTED can be used.
@itisnajim
Copy link
Owner

u have this check:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                    context.registerReceiver(appDeviceAdminReceiver, intentFilter, Context.RECEIVER_NOT_EXPORTED)
                }else {
                    context.registerReceiver(appDeviceAdminReceiver, intentFilter)
                }

so we can keep in build.gradle compileSdkVersion 31 instead of 33 ?

android {
    compileSdkVersion 31
    //compileSdkVersion 33
   ...

what do u think ?

@endmr11
Copy link
Author

endmr11 commented Oct 8, 2024

If the Context.RECEIVER_NOT_EXPORTED statement does not give an error, that parameter can remain as 31 at build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants