Request support for Android targetSdkVersion 31 (release-1.25.0)
Expected Behavior
Manifest merger succeeds at compile time and a java.lang.SecurityException is not thrown at runtime (see below).
Current Behavior
What is the current behavior?
Manifest merger fails because Zettle services and receivers do not specify the android:exported attribute and an additional Bluetooth permission is needed at runtime:
java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for android.content.AttributionSource@513489c3: GattService registerScanner at android.os.Parcel.createExceptionOrNull(Parcel.java:2425) at android.os.Parcel.createException(Parcel.java:2409) at android.os.Parcel.readException(Parcel.java:2392) at android.os.Parcel.readException(Parcel.java:2334) at android.bluetooth.IBluetoothGatt$Stub$Proxy.registerScanner(IBluetoothGatt.java:1727) at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.startRegistration(BluetoothLeScanner.java:426) at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:278) at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:154) at com.izettle.payments.android.bluetooth.ble.PlatformScannerWrapperV21Impl.start(Line:6) at com.izettle.payments.android.bluetooth.ble.BleScannerImpl.startScanner$zettle_payments_sdk(Line:1) at com.izettle.payments.android.bluetooth.ble.BleScanner.onStartScan(Line:4) at com.izettle.payments.android.bluetooth.ble.BleScanner.access$onStartScan(Line:1) at com.izettle.payments.android.bluetooth.ble.BleScanner$$special$$inlined$stateObserver$1.onNext(Line:3) at com.izettle.android.commons.state.StateImpl$$special$$inlined$forEach$lambda$1.invoke(Line:2) at com.izettle.android.commons.state.StateImpl$$special$$inlined$forEach$lambda$1.invoke(Line:1) at com.izettle.android.commons.thread.EventsLoopKt$sam$java_lang_Runnable$0.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67)
<!-- Zettle services and receivers are not setting android:exported attribute -->
<service
android:name="com.izettle.android.auth.sync.ZettleSyncService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name="com.izettle.android.auth.sync.ZettleSyncAlarmReceiver" />
<service
android:name="com.izettle.android.auth.ZettleAuthService"
android:enabled="true" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
Steps to Reproduce
Build and run using targetSdkVersion 31
Context
targetSdkVersion 31 running on Android version 31
Failure Logs
See stack trace above
Hi, thank you for reporting. This is planned in our backlog and will most likely be in the next point release.
Until the new version is released, it should be enough to add the following to your apps manifest to be able to target android 12 (api 31).
<service android:name="com.izettle.android.auth.sync.ZettleSyncService" android:exported="false"/>
<service android:name="com.izettle.android.auth.ZettleAuthService" android:exported="false"/>
<receiver android:name="com.izettle.android.auth.sync.ZettleSyncAlarmReceiver" android:exported="false"/>
Please update to solve this issue
Update for release 1.25.0 of the SDK. The payment flow still isn't requesting the necessary android.permission.BLUETOOTH_SCAN permission when targeting Android 12+. See crash below:
java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for android.content.AttributionSource@ef13e190: GattService registerScanner at android.os.Parcel.createExceptionOrNull(Parcel.java:2425) at android.os.Parcel.createException(Parcel.java:2409) at android.os.Parcel.readException(Parcel.java:2392) at android.os.Parcel.readException(Parcel.java:2334) at android.bluetooth.IBluetoothGatt$Stub$Proxy.registerScanner(IBluetoothGatt.java:1727) at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.startRegistration(BluetoothLeScanner.java:426) at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:278) at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:154) at com.izettle.payments.android.bluetooth.ble.PlatformScannerWrapperV21Impl.start(SourceFile:18) at com.izettle.payments.android.bluetooth.ble.BleScannerImpl.startScanner$zettle_payments_sdk(SourceFile:1) at com.izettle.payments.android.bluetooth.ble.BleScanner.onStartScan(SourceFile:11) at com.izettle.payments.android.bluetooth.ble.BleScanner.access$onStartScan(SourceFile:1) at com.izettle.payments.android.bluetooth.ble.BleScanner$$special$$inlined$stateObserver$1.onNext(SourceFile:111) at com.izettle.android.commons.state.StateImpl$$special$$inlined$forEach$lambda$1.invoke(SourceFile:2) at com.izettle.android.commons.state.StateImpl$$special$$inlined$forEach$lambda$1.invoke(SourceFile:1) at com.izettle.android.commons.thread.EventsLoopKt$sam$java_lang_Runnable$0.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67)
Resolved with release-1.25.4, many thanks.
Resolved with release-1.25.4, many thanks.
Hi @planetcoops, there was a bug in 1.25.4 that have been resolved in 1.25.5 that is now available. To not let 1.25.4 spread too much I had to delete the release.