Skip to content

Fix api33#22

Open
Zeno97 wants to merge 1 commit intoZebraDevs:masterfrom
Zeno97:master
Open

Fix api33#22
Zeno97 wants to merge 1 commit intoZebraDevs:masterfrom
Zeno97:master

Conversation

@Zeno97
Copy link
Copy Markdown

@Zeno97 Zeno97 commented Mar 20, 2024

This pull requests fixes conflict issues with api 33

@TheNoiselessNoise
Copy link
Copy Markdown

TheNoiselessNoise commented May 28, 2024

From SDK 33 (Android 13) registerReceiver needs a flag, otherwise you get a SecurityException.
java.lang.SecurityException: com.package.name: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts.

if (android.os.Build.VERSION.SDK_INT >= 33) {
    registerReceiver(dataWedgeBroadcastReceiver, intentFilter, RECEIVER_EXPORTED)
} else {
    registerReceiver(dataWedgeBroadcastReceiver, intentFilter)
}

@Zeno97
Copy link
Copy Markdown
Author

Zeno97 commented Nov 3, 2024

From SDK 33 (Android 13) registerReceiver needs a flag, otherwise you get a SecurityException. java.lang.SecurityException: com.package.name: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts.

if (android.os.Build.VERSION.SDK_INT >= 33) {
    registerReceiver(dataWedgeBroadcastReceiver, intentFilter, RECEIVER_EXPORTED)
} else {
    registerReceiver(dataWedgeBroadcastReceiver, intentFilter)
}

Hello, thanks for the advice. In my case I was compiling target api 33 but zebra device was Android 7 and for this this pull request was working.
Actually I don't own anymore a zebra device, so I can't really help in my current situation.
For everyone is looking for a solution for a Zebra with android 11 I would suggest to sub fork my fork and try this snippet.

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