cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Asset Manager official app - Offline maps - permissions on newer Android

Radek_Uhlir
Explorer
0 Kudos

I want to use Offline maps in SAP Asset Manager mobile application. Some time ago I built SAP Service and Asset Manager in the BTP cockpit. Version: SAM version 2305, Android 10/11 (or lover). I installed it on my Android devices and copied a .tpk file (my map). Then I had to go to the permissions (in Android settings) and grant permission to access files.

Apps -> Permissions -> Permissions -> Files -> See more apps that can access all files -> (scroll and find) SAM
|O| Allow access to manage all files
| | Don't allow

So far so good.

But when I install the official SAP Service and Asset Manager from Google Play, the application does not have permission to access my offline map (I cannot grand the permission). In one device, I do not have SAM in the list of applications to grant File access permission. On another Android device, I have a missing option.

Android Settings -> Apps -> Permissions -> Permissions -> Files and media -> (scroll and find) SAM
|O| Allow management of all files    ! the option is missing for this app !
| | Allow access to media only
| | Don't allow

My older SAM built by BTP with an Android API level lower than 29 has this option in Android Settings.

In Android, can I somehow grant the permission even when .apk does not say the permission is required? I suppose the permission has to be specified in AndroidManifest.xml and this file can be distributed only with the .apk? I need to use the official application from the store.

Accepted Solutions (0)

Answers (4)

Answers (4)

sichaohu
Associate
Associate
0 Kudos

Hi,

On Android 10 and above, you don't have to ask for granting file permission. Permissions of App scoped files will be granted automatically. However, if you want to access files out of your app sandbox, that will be challenging. You will need to access that file created by other app via ContentProvider

 

Reference: https://developer.android.com/training/data-storage/shared/media#storage-permission-not-always-neede...

 

Regards

Radek_Uhlir
Explorer
0 Kudos

I have tested this problem on 4 Android devices. On all of them, I have a permission problem, when the target API is 30+.
Today I also updated one device to Miumi 14.0.12.0, Android 13 TKQ1.221114.001. It did not help.

In <my SAM 2310 project>.mdkproject\App_Resources_Merge\Android\src\main\AndroidManifest.xml
is line

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:node="remove"/>

The "tools:node="remove" is important (is the problem).
I changed this line to:

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

I added legacy permissions (Android 11 and below), just to be sure:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I rebuilt the client by command create-client.cmd, reinstalled .apk and the problem is fixed. Now I have the option "Allow access to manage all files" available. So I will ask SAP to fix it.

My guess, when SAP uploaded a new client version to Google Developer Console for review, Google rejected the app because of the permission <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>. So somebody in the SAP removed (added tools:node="remove") the permission without knowing, it is required for offline maps.

Radek_Uhlir
Explorer
0 Kudos

I have tested this problem on 4 Android devices. On all of them, I have a permission problem, when the target API is 30+.
Today I also updated one device to Miumi 14.0.12.0, Android 13 TKQ1.221114.001. It did not help.

In my branded client I have the same problem. In <my SAM 2310 project>.mdkproject\App_Resources_Merge\Android\src\main\AndroidManifest.xml
is line

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:node="remove"/>

The "tools:node="remove" is important (is the problem).
I changed this line just to:

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

I added legacy permissions (Android 11 and below), just to be sure:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I rebuilt the client by command create-client.cmd,
reinstalled .apk and the problem is fixed. Now I have the option "Allow access to manage all files" available. So I will ask SAP to fix it.

My guess, when SAP uploaded a new client version to Google Developer Console for review, Google rejected the app because of the permission <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>. So somebody in the SAP removed (added tools:node="remove") the permission without knowing, it is required for offline maps.

muhammad_rafay
Advisor
Advisor
0 Kudos

Did you try to install the official Play Store application on the latest version of the Android and check the permission there?

Radek_Uhlir
Explorer
0 Kudos
Yea I am using the latest version. I am trying to answer my own question, but my answer is kept being deleted. So in short - the problem is in <project>.mdkproject\App_Resources_Merge\Android\src\main\AndroidManifest.xml. There is wrong permission. Instead of allow, there is remove permission: <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:node="remove"/>. Permission what should be used: <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
muhammad_rafay
Advisor
Advisor
0 Kudos
I believe this was intended for play store client. But I can forward this to our developer to further take a look and he can help
Radek_Uhlir
Explorer
0 Kudos
I also believe it was intended. However, I do not see any info in any documentation or SNote about this problem. In the current state, offline maps do not work in the official app for Android. I would guess, SAP tried to upload a new client version to Google Developer Console for review, but Google rejected the app because of the permission, so somebody removed the permission. It is interesting when I decompile map-release.aar (library for Esri maps in SAM), in AndroidManifest.xml are permissions READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, but not MANAGE_EXTERNAL_STORAGE. Those two permissions should have no effect for Android API level 30+.
muhammad_rafay
Advisor
Advisor
0 Kudos
You can also check the iOS app and verify if it is working as intended or similar to how Android is working
Radek_Uhlir
Explorer
0 Kudos
I do not have iOS, but I will get one and test it. On Android I tested the permission - I built my own SAM 2310 in Visual Studio Code. The problem is there too. When I changed the permission in AndroidManifest.xml, the map started working as expected.