Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By CarlosAD
#821968
Hello everyone,
A couple days ago I tried to display some information in a Dynaform depend by location of the user. I create a default script in JavaScript and HTML5 to get geolocation of the current user and I have some troubles with that, Web and IOS environment works fine but Android environment doesn’t work because application says, “Geolocation deny by User”.
When I try to configurated my mobile to allow geolocation for ProcessMaker and when I do that Android says “ProcessMaker was developed in older Android Version” and doesn’t work fine. (I try to resolve this issue with Android 5.1, 6.1, 7.1 and 8.1 and all of them said me the same.
I want to know if this is a bug only for Android devices or if I need an additional configuration on my mobile to run these premises.

https://drive.google.com/file/d/1MSJ9GX ... XbuHx/view
https://drive.google.com/file/d/1Guh7KR ... BcjER/view
https://drive.google.com/file/d/1NZluPx ... 7QkcJ/view
#821975
I doubt that the geolocation code has been updated for several years, so it wouldn't surprise me if Google's API has changed since then. I don't have access to the source code to check it since it is proprietary, but I recommend posting a bug report about it at http://bugs.processmaker.com

And post a link to your bug report here on the forum, so others can follow it.
#821989
Thanks for your answer, amosbatto

The problem here is that I'm not using Google's API for this test, I only execute this code in Javascript:
Code: Select all
function getLocation() {
  if ("geolocation" in navigator) {
    navigator.geolocation.getCurrentPosition(showPosition,showError);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {
  x.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude;    
}

function showError(error) {
  switch(error.code) {
    case error.PERMISSION_DENIED:
      x.innerHTML = "User denied the request for Geolocation."
      break;
    case error.POSITION_UNAVAILABLE:
      x.innerHTML = "Location information is unavailable."
      break;
    case error.TIMEOUT:
      x.innerHTML = "The request to get user location timed out."
      break;
    case error.UNKNOWN_ERROR:
      x.innerHTML = "An unknown error occurred."
      break;
  }
}
var x = document.getElementById("demo");
getLocation();
And the response from different environments are these:

Web:

Image

iPhone and iPads:

Image

Android Mobile:

Image
Image

This is the project in my local PM for if you want to test it:
https://drive.google.com/open?id=1bS5kW ... 32LNl5sQh-

Thanks for your attention.
#821990
Yes, I tested the ProcessMaker Mobile App in Android 6 and I'm seeing the same problem. The App for Android is totally different code from the App in iOS, so they can have different behavior.

This code needs to be added to Mobile App for Android to allow it to access location information:
Code: Select all
public class MainActivity extends AppCompatActivity {

    private final int REQUEST_LOCATION_PERMISSION = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        requestLocationPermission();
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

        // Forward results to EasyPermissions
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
    }

    @AfterPermissionGranted(REQUEST_LOCATION_PERMISSION)
    public void requestLocationPermission() {
        String[] perms = {Manifest.permission.ACCESS_FINE_LOCATION};
        if(EasyPermissions.hasPermissions(this, perms)) {
            Toast.makeText(this, "Permission already granted", Toast.LENGTH_SHORT).show();
        }
        else {
            EasyPermissions.requestPermissions(this, "Please grant the location permission", REQUEST_LOCATION_PERMISSION, perms);
        }
    }
}
See: https://stackoverflow.com/questions/401 ... -android-6

You can file a bug report asking that code to be added.

In the meantime, you can use the Mobile User Experience in a normal web browser in your mobile devices. I just tried your javascript code in an Android 6 phone and it works.
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]