I want the user should give the permission of location or else the app will close, how to do it ??
If he grants he can proceed or else the app closes..
Thanks,,
I want the user should give the permission of location or else the app will close, how to do it ??
If he grants he can proceed or else the app closes..
Thanks,,
WOW that worked great, a issue here that it only ensures that user is providing location when app launches but if the user closes the location after 2 minutes, then how to show him the dialog box again ?
The method above is for location permissions. When you allow permissions in the app then go to app settings and disable locating permissions, the app will reset and restart asking for permissions again.
If you are writing about a location service, however, it is completely different. Best to record the screen and show what you mean, demonstrate the problem. Then we will come up with a solution.
Even If I give permission in the pop up the location is showing lat n long 0,0 n when im manually going to setting n swithing on location then it showing me my true location. I want to force user to turn on location manually if pop up not working even if i allow location in pop up. im using android 12
To ask for location permission and enable locations are 2 different things
You can use the following blocks to open the location settings for the user
Taifun
where can find r the block "openLocationSettings" in this last answe?
Thanks.
It is procedure you create yourself.
Thanks.
is it a button or what in MIT APP?
What is a custom procedure? See here
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .
Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by
Taifun.
Great, thanks,
I misunderstood your second to last answer.
Android 13… I solve problem with this 2 lines (you see request only if permission is not already granted, so first launch of app).
The permission request is automatic if I use the system component, but if I use the GpsTool Extension ( [FREE] GpsTool Extension - Extensions - Kodular Community ), it generates an error at startup due to lack of permissions (unless I manually set it in the phone UI).
The first time I launch it, I still get the error generated by the extension, but I also get a request to grant permission. Therefore, from the second time I launch it, no more requests appear and the permission remains set.
First ask for necessary permissions and only if those have been granted use the blocks from the extension
Taifun
Problem is just first launch of application, after is no problem
You might want to read this:
Which means you are trying to use the extension in event Screen1.Initialze before permissions have been granted
Taifun
In addition, you have to request permissions one by one.
Dear @gabriele_ponte, almost everything has been already said in the previous posts, so what I wish ato add is simply a "trick" on how you might probably avoid initial error messages, issued at the first launch, when permissions have not been granted yet.
At screen1 initialization you can load a Splash screen that warns the user to wait a while (i.e. something like a houglass that lets the sand to flow down). Then always in Screen1 .initialization you ask for permissions, whose activation might need some time, and you start a clock that after (for example) one second, clears the splash screen, disables itself and goes on with the app's flow.
I typically use this trick to allow files opening at Screen 1 initialization block, since I have experienced that the OS (Android) normally takes a while to accomplish the read-file task and makes the data-buffer to be available.
Generally speaking, when at app's launch there is a task that involves the OS, I always leave some spare time so the OS can do its own job (i.e. synchronization matters).
In addition to this you can use Tinydb to store a "not first launch" flag. In a nutshell: at the very first launch the Tinydb tag "First Launch" will be empty, therefore you can ask for permissions, and then after permissions have been successfully granted, tou can store in Tinydb the value "Granted", so at every subsequent launch of the app, the value will not be empty and your app can skip the permission asking phase. Trick over tricks ..... ![]()
Best wishes for your project.