square / react-native-square-reader-sdk

React Native Plugin for Square Reader SDK
Apache License 2.0
117 stars 36 forks source link

Storage permissions not detected when using compileSdkVersion 33 or Android 13 #215

Closed fobos531 closed 1 year ago

fobos531 commented 1 year ago

Describe the issue

The Square Reader SDK is unable to work with devices running compileSdkVersion 33, i.e. Android 13. I know that the docs mention to use compileSdkVersion of 32, but unfortunately I am not able to downgrade to version 32. I would highly appreciate if the underlying SDK's code could be adjusted to to support permissions introduced in Android 13.

To Reproduce

  1. Run the example app on Android 13
  2. Try opening reader settings - you'll be able to grant all permissions except the storage one.

Expected behavior

The underlying reader SDK should detect that indeed all the necessary permissions have been granted on Android 13.

Environment (please complete the following information):

Platform: Android OS: 13 Dev environment: macOS Reader SDK version: latest stable version (I think its 1.6.9)

Screenshots

CleanShot 2023-03-02 at 10 32 24@2x

This is what I'm stuck with, and Square Reader SDK doesn't detect that the permissions have been granted, no matter what I do.

@CharmisG I would highly appreciate if the support for Android 13 can be added to the Reader SDK.

Thanks

fka3 commented 1 year ago

Compile SDK 33 should be fine. We're still targeting SDK less than 33... as far as I know, that should be fine also, but more hesitation there.

fobos531 commented 1 year ago

Compile SDK 33 should be fine. We're still targeting SDK less than 33... as far as I know, that should be fine also, but more hesitation there.

Hey, thanks for getting back. AFAIK I'm using both the compile and target sdk of 33 and the SDK works just fine on Android 11 devices, for example. The issue is being by my users with Android 13. Unfortunately I'm unable to lower my target/compile sdk version to <33 as I'm using other SDKs that depend on the target/compile sdk versions being 33.

This is even more puzzling as the official Square Point of Sale app does not have this issue. The granted granular storage permissions of Android 13 are detected just fine. I'm assuming the reader SDK isn't yet updated to handle the granular storage permissions and therefore doesnt detect that the storage permissions were indeed granted. Can you confirm @fka3 ? Please let me know if there's anything I can do to assist in resolving this. Thank you!

fobos531 commented 1 year ago

Hey @fka3 , I was indeed able to solve this by targeting 32 instead of 33. For the time being, this is an okay solution, but I would greatly appreciate if this could be resolved in the SDK itself so that it works fine with target 33. I would go ahead and try implementing it myself, but it looks like that part of the code (permission management) is closed-source. Please correct me if I'm wrong.

EDIT: Just saw this, https://github.com/square/react-native-square-reader-sdk/pull/216 will report back once it is merged and let you know if it resolved the issue

CharmisG commented 1 year ago

Hello @fobos531 We upgraded compileSDK and targetSDK so can you please try and check if it is working or not ?

fobos531 commented 1 year ago

@CharmisG

Can you publish the new version to NPM so I can test?

fka3 commented 1 year ago

Yeah, we've determined that targeting 33 doesn't work, but we're going to need to fix that for ourselves, too.

You could probably do something ugly to target 33 but tools:remove or tools:replace to remove the request for storage permission, but we need a "proper" fix (i.e. one from Square) anyway, yes.

fobos531 commented 1 year ago

Hey @fka3 , thanks for getting back! I assume your proposed solution would simply remove it from the manifest, but as the Reader SDK is actually using Square's Android Activities/prebuilt UI, I'm betting the permission stuff is something that needs to be handled properly on Square's side as you mentioned.

Let me know if there's anything I can do to assist in resolving this.

karmatradeDev commented 1 year ago

Hi, I'm having this exact same issue , was there any update on squares end?

fobos531 commented 1 year ago

Hey @karmatradeDev , not too long ago a new version of the Android SDK was released - https://developer.squareup.com/docs/changelog/mobile-logs/2023-07-27

You could see if that works for you.

fka3 commented 1 year ago

As far as we know the new releases do properly support API 33. Going to close this as a result, but please reopen if you find a problem!

fobos531 commented 1 year ago

Hey @fka3 , yeah, I've seen that and I've recently updated - so far I haven't been seeing any issues, but will let you know if any arise. Thank you!