4 Replies Latest reply on Dec 25, 2017 1:31 PM by kglad

    Geolocation permission on Android with AIR 28

    Stephdidou Level 1

      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"/>