Robert Valentino Well-Known Member Licensed User Longtime User Mar 20, 2021 #1 I'm over 70 and forget what commands are available for what SDK versions. I just used a command Code: Dim paths() As Object = GetContext.RunMethod("getExternalFilesDirs", Array(Null)) on a device running OS 4.1.2 and SDK 16 now this command is not available until SDK 19 Now my min / max sdk in my manifest is set to Code: <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/> Is there a routine that will type check (not sure if that is the right term here) and let me know that commands are outside my min skd version (something I could put 'ignore on if I was checking the SDK around it) I am sure with everyone being forced into moving up to SDK 30 that we all may run into these cases. I was lucky I was testing on a very old device so it caught this bug. But I am sure some can/will make it to production if we aren't careful Any routine for this anyone know of? Is this something the IDE can check for us? Not sure if I should put this in the Wish list, but if someone has a routine that we can run then please share. BobVal BobVal
I'm over 70 and forget what commands are available for what SDK versions. I just used a command Code: Dim paths() As Object = GetContext.RunMethod("getExternalFilesDirs", Array(Null)) on a device running OS 4.1.2 and SDK 16 now this command is not available until SDK 19 Now my min / max sdk in my manifest is set to Code: <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/> Is there a routine that will type check (not sure if that is the right term here) and let me know that commands are outside my min skd version (something I could put 'ignore on if I was checking the SDK around it) I am sure with everyone being forced into moving up to SDK 30 that we all may run into these cases. I was lucky I was testing on a very old device so it caught this bug. But I am sure some can/will make it to production if we aren't careful Any routine for this anyone know of? Is this something the IDE can check for us? Not sure if I should put this in the Wish list, but if someone has a routine that we can run then please share. BobVal BobVal
DonManfred Expert Licensed User Longtime User Mar 20, 2021 #2 It is added in Api 19. https://developer.android.com/reference/android/content/Context#getExternalFilesDirs(java.lang.String) Upvote 0
It is added in Api 19. https://developer.android.com/reference/android/content/Context#getExternalFilesDirs(java.lang.String)
Robert Valentino Well-Known Member Licensed User Longtime User Mar 20, 2021 #3 I think you missed I said that (this command is not available until SDK 19) but the device I said was running API 16 (device running OS 4.1.2 and SDK 16) Thing I forgot to do was Code: if API >= 19 then getexternalfilesdir command else .... do something end if If I could get something to pre-check my code to make sure I am not using commands without the API check around them. Or maybe something to show me what API the commands I am using are. Upvote 0
I think you missed I said that (this command is not available until SDK 19) but the device I said was running API 16 (device running OS 4.1.2 and SDK 16) Thing I forgot to do was Code: if API >= 19 then getexternalfilesdir command else .... do something end if If I could get something to pre-check my code to make sure I am not using commands without the API check around them. Or maybe something to show me what API the commands I am using are.
Robert Valentino Well-Known Member Licensed User Longtime User Mar 20, 2021 #5 Let me make it more simple. I want something to show / tell me what API is required for ALL the commands I am using Upvote 0
Let me make it more simple. I want something to show / tell me what API is required for ALL the commands I am using
agraham Expert Licensed User Longtime User Mar 20, 2021 #6 I don't think you will find it. You will need to look each one up in the Android development documentation to see when it was made available and if it is deprecated. Upvote 0
I don't think you will find it. You will need to look each one up in the Android development documentation to see when it was made available and if it is deprecated.
Robert Valentino Well-Known Member Licensed User Longtime User Mar 20, 2021 #7 I guess a lint checker is what I will start looking for? Must be something that we can say check my code against SDK n and have it report all calls that aren't available for SDK n (note: n being any sdk number) Upvote 0
I guess a lint checker is what I will start looking for? Must be something that we can say check my code against SDK n and have it report all calls that aren't available for SDK n (note: n being any sdk number)
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2021 #8 Robert Valentino said: I just used a command Click to expand... Don't. Use RuntimePermissions.GetAllSafeDirsExternal. Upvote 0
Robert Valentino said: I just used a command Click to expand... Don't. Use RuntimePermissions.GetAllSafeDirsExternal.