• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Geolocation permission on Android with AIR 28

Contributor ,
Dec 25, 2017 Dec 25, 2017

Copy link to clipboard

Copied

Hi,

I just saw that, with AIR 28, we need to ask permission to the user within the app for Geolocation.

I read the example in the AIR 28 Release Note but it's only about Camera.

Does someone could help me and tell me all the steps to ask the user to allow the geolocation please ?

Do I only have to put it in AS3 code ?

If so, is it something like this ? :

var _userGeo2 = new Geolocation()

if (Geolocation.isSupported){         

                if (Geolocation.permissionStatus != PermissionStatus.GRANTED){

                    _userGeo2.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {

                        if (e.status == PermissionStatus.GRANTED)     {

                            // WHAT SHOUD I PUT HERE ????

                        }

                        else {

                            // permission denied

                        }

                    });

Do I have to change something in the xml file as well of can I just let this line ?

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

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

Views

877

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 25, 2017 Dec 25, 2017

in my experience, it doesn't work to request permission after a user has denied it on app start-up, but it wouldn't hurt to try.

check for permission, if granted proceed; if not, don't try to utilize geolocation.

Votes

Translate

Translate
Community Expert ,
Dec 25, 2017 Dec 25, 2017

Copy link to clipboard

Copied

yes, that xml needs to be in your app descriptor.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 25, 2017 Dec 25, 2017

Copy link to clipboard

Copied

OK, but what should I put on the line

"WHAT SHOUD I PUT HERE ???" 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 25, 2017 Dec 25, 2017

Copy link to clipboard

Copied

Hmm I think I should also put

try {

                        _userGeo2.requestPermission();

                    }

No?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 25, 2017 Dec 25, 2017

Copy link to clipboard

Copied

LATEST

in my experience, it doesn't work to request permission after a user has denied it on app start-up, but it wouldn't hurt to try.

check for permission, if granted proceed; if not, don't try to utilize geolocation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines