Permissions help

bluetooth1.aia (273.9 KB)

The new version cannot scan

and again:

I think it is Bluetooth permission but I am not sure

What (error) message did you get? Post a screenshot.

No error message but unable to scan Bluetooth
the same aia
I can't understand why this happens

"In order for Android 10 to detect BLE devices, the permission must be set to ACCESS_FINE_LOCATION (and not ACCESS_COARSE_LOCATION)."

These permissions are declared in the Manifest of your APK:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>

Thank you Sinier for your help!!, I will try again and do more testing.

Thank you very much for your kind reply Anke!!
I will try what you suggested me. However I have another question
I Understand that permissions that you have in the Manifest by default like the following:

Read Storage
Write Storage
Access to internet
Permission to see connections on network
Permission to control Vibration
Permission to see connections to wifi

These six are the ones we can handle,
in other words if you have a persmission listed in the Manifest you can grant permission or deny it. Am I correct?

But what about other permissions like for example:

Permission to avoid the screen going to sleep" I would need to add it to the Manifest but how?? could you please help me.

Thank you very much for your kind help.

Thank you Anke for your help!
I hope this may help Javier.
My problem was solved. I tried to find the offline version. The application compiled from the old version worked normally. I checked the release notes and it was updated the day before yesterday. I believe there are some changes after the update.(183c>>184)
Release Notes:
http://appinventor.mit.edu/ai2/ReleaseNotes.html

Dear Sinieer, Thank you very much for thinking about me I am glad to know that you have solved your problem.
I have checked the link you posted and I have seen there are changes since 30 of july 2020.

This is what I have added to my code.


This is the behaviour of the app after the code:
When I start downloading it says: "Do you want to install this application. It does not require special permissions". however If you see the code I apply for the permissions READ and WRITE

After app is installed it says the following:
"Application needs your permission to access to photos and multimedia files"

Either I Accept or deny gives me the error
It says:
Error 908 The permission "READ_EXTERNAL_STORAGE has been denied.

When I check permissions for the app on my mobile
It has permission but only to read but not to write

It works normallytest (1).aia (2.1 KB)

Guys

Instead of requesting READ_EXTERNAL_STORAGE when Screen1 Initialize,
request WRITE_EXTERNAL_STORAGE only

Once granted write permission, read permission should be automatic.

@ Javier you have a typo in the 2nd IF of the when Screen1 Permission Granted Block:

you have WRITE_EXTERNALSTORAGE
should be WRITE_EXTERNAL_STORAGE

You only need to test permissionName for WRITE_EXTERNAL_STORAGE

1 Like

Thank you very very much Chris, that typo was in front of me and I did not notice, Thank you again!!

Yes, to ask for permissions (and grant / deny them), they must be declared in the Manifest.

There is no permission for that. You need to use the KeepScreenOn method of the TaifunTools extension App Inventor Extensions: Tools | Pura Vida Apps

grafik

And as @ChrisWard said, WRITE_EXTERNAL_STORAGE is sufficient as it implicitly grants READ permission. Manifest.permission  |  Android Developers

1 Like

For BLE see here:

Dear Anke, Thank you very much for all your help, you are really a kind person. Danke Schön.
I have one last question how to manage permission Deny.
when I press Deny it works ok the first time to print "please we need your permission tu run this app", but next time when I press deny error 908 appears.
Have a nice evening.

Thanks a lot for your message TIMAI2

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thank you for the suggestion Taifun!!

Hi Taifun,

I think there is something wrong with the new AI2 version. I always test my project by installing it on my phone after it is removed for debugging. To day I found that whether or not I ask for permission (WRITE_EXTERNAL_STORAGE) in my application, I was prompted to answer for permission by the system. When I answer "Yes", it doesn't go to my "PermissionGranted" procedure and just hang there with a black screen. If I answer "No", it will go to my "PermissionDenied" procedure and then I will ask for permission again, and everything works fine from there. But it is not logical to answer "No" in the beginning, and I am sure the first permission is not asked by my app ("screen1.AskForPermission").

Truely,
Anthony Chow