android-js / androidjs

Platform to build android app using node js
MIT License
466 stars 109 forks source link

app.location is undefined #213

Open KCGD opened 3 years ago

KCGD commented 3 years ago

Describe the bug I'm trying to use the location API by calling app.location.get() (i included all the proper permissions), but it returns undefined. i tried inspecting the app object with vconsole and its missing the location property.

Expected behavior I expected the location property to be part of the app and for app.location.get to return either the device's coordinates or an error

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context app.location is also undefined when testing the app in my desktop's browser

ajbogh commented 2 years ago

I have the same issue. app.location is undefined.

package.json

"permission": [
        "android.permission.INTERNET",
        "android.permission.ACCESS_FINE_LOCATION",
        "android.permission.ACCESS_COARSE_LOCATION",
        "android.permission.ACCESS_BACKGROUND_LOCATION"
    ],

navigator.geolocation also errors. navigator.geolocation.watchPosition returns the PERMISSION_DENIED error code (1).

The terminal shows quite a number of service manager errors (shown below). These may or may not be related, but they are definitely related to the app I'm working on.

ServiceManager: Permission failure: android.permission.HIGH_SAMPLING_RATE_SENSORS from uid=xxxxx pid=21025

I checked the app permissions in the Android settings and the Location permission is allowed all the time, the precise location toggle is checked, and the remove permissions and free up space toggle is not checked.

Is there a way to get location permissions to work?

Chhekur commented 2 years ago

Hey @KCGD @ajbogh, can you both make sure that you are using the latest version of Android JS?