Location request timed out

Hi,

I try using GeoLocation. But return to me Location request timed out error. The location information that came to me is wrong. I get the same error when I want to get continuous location information. I used code following.

How can I fix it?


<App>
    <JavaScript>
        var Observable = require("FuseJS/Observable");
        var GeoLocation = require("FuseJS/GeoLocation");
    
        // Immediate
        var immediateLocation = JSON.stringify(GeoLocation.location);

        // Timeout
        var timeoutLocation = Observable("");
        var timeoutMs = 5000;
        GeoLocation.getLocation(timeoutMs).then(function(location) {
            timeoutLocation.value = JSON.stringify(location);
        }).catch(function(fail) {
            console.log("getLocation fail " + fail);
        });

        // Continuous
        var continuousLocation = Observable("");
        GeoLocation.onChanged = function(location) {
            continuousLocation.value = JSON.stringify(location);
        };

        function startContinuousListener() {
            var intervalMs = 1000;
            var desiredAccuracyInMeters = 10;
            GeoLocation.startListening(intervalMs, desiredAccuracyInMeters);
        }

        function stopContinuousListener() {
            GeoLocation.stopListening();
        }

        module.exports = {
            immediateLocation: immediateLocation,
            timeoutLocation: timeoutLocation,
            continuousLocation: continuousLocation,

            startContinuousListener: startContinuousListener,
            stopContinuousListener: stopContinuousListener
        };
    </JavaScript>

    <StackPanel>
        <Text>Immediate:</Text>
        <Text Value="{immediateLocation}" />

        <Text>Timeout:</Text>
        <Text Value="{timeoutLocation}" />

        <Text>Continuous:</Text>
        <Text Value="{continuousLocation}" />

        <Button Text="Start continuous listener" Clicked="{startContinuousListener}" />
        <Button Text="Stop continuous listener" Clicked="{stopContinuousListener}" />
    </StackPanel>
</App>
Macs-Mac-mini:location macmini$ fuse preview -t android
Fuse 0.29.0 (build 8396)
Build started: FullCompile
Configuring (11.1s)
Compiling syntax tree (13.3s)
Generating code and data (33.6s)
Building Android app
1/2: liblocation.so
2/2: location.apk
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
(4:12)

Build completed in 310.51 seconds
Build ended
Installing APK on 1 device(s)
Launching activity 'location'
Running logcat on 'CB5A1PV9RN'
I/ActivityManager( 1017): Start proc 31942:com.apps.location/u0a235 for activity com.apps.location/.location
I/art     (31942): Late-enabling -Xcheck:jni
W/ResourceType(31942): Found multiple library tables, ignoring...
W/ResourceType(31942): Found multiple library tables, ignoring...
D/location(31942): SUT: false  CML: false  SDK: 22
I/Adreno-EGL(31942): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.AF.1.1_RB1.05.00.02.006.020_msm8960_LA.AF.1.1_RB1__release_AU ()
I/Adreno-EGL(31942): OpenGL ES Shader Compiler Version: E031.25.03.06
I/Adreno-EGL(31942): Build Date: 05/22/15 Fri
I/Adreno-EGL(31942): Local Branch: mybranch10237523
I/Adreno-EGL(31942): Remote Branch: quic/LA.AF.1.1_rb1.18
I/Adreno-EGL(31942): Local Patches: NONE
I/Adreno-EGL(31942): Reconstruct Branch: AU_LINUX_ANDROID_LA.AF.1.1_RB1.05.00.02.006.020 + 9b2699f + 2215637 + 60aa592 + f2362e6 + 5c64f59 + 82411a1 + 89a0db6 + 6151be1 +  NOTHING
D/OpenGLRenderer(31942): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/Atlas   (31942): Validating map...
I/OpenGLRenderer(31942): Initialized EGL, version 1.4
D/OpenGLRenderer(31942): Enabling debug mode 0
I/Timeline(31942): Timeline: Activity_idle id: android.os.BinderProxy@23a518e6 time:68344033
I/Choreographer(31942): Skipped 63 frames!  The application may be doing too much work on its main thread.
I/location(31942): getLocation fail Location request timed out
I/location(31942): getLocation fail Location request timed out

Hi,

I upgraded 0.30. But nothing changed.

Macs-Mac-mini:location macmini$ uno clean
Clean completed

Macs-Mac-mini:location macmini$ fuse preview -t android
Fuse 0.30.0 (build 8529)
Build started: FullCompile
Configuring (13.8 s)
Compiling syntax tree (23.3 s)
Generating code and data (38.7 s)
Building Android app
1/2: liblocation.so
2/2: location.apk
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
(4:36)

Build completed in 352.46 seconds
Build ended
Installing APK on 1 device(s)
Launching activity 'location'
Running logcat on 'CB5A1PV9RN'
I/ActivityManager(  766): Start proc 21678:com.apps.location/u0a238 for activity com.apps.location/.location
I/art     (21678): Late-enabling -Xcheck:jni
W/ResourceType(21678): Found multiple library tables, ignoring...
W/ResourceType(21678): Found multiple library tables, ignoring...
D/location(21678): SUT: false  CML: false  SDK: 22
I/Adreno-EGL(21678): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.AF.1.1_RB1.05.00.02.006.020_msm8960_LA.AF.1.1_RB1__release_AU ()
I/Adreno-EGL(21678): OpenGL ES Shader Compiler Version: E031.25.03.06
I/Adreno-EGL(21678): Build Date: 05/22/15 Fri
I/Adreno-EGL(21678): Local Branch: mybranch10237523
I/Adreno-EGL(21678): Remote Branch: quic/LA.AF.1.1_rb1.18
I/Adreno-EGL(21678): Local Patches: NONE
I/Adreno-EGL(21678): Reconstruct Branch: AU_LINUX_ANDROID_LA.AF.1.1_RB1.05.00.02.006.020 + 9b2699f + 2215637 + 60aa592 + f2362e6 + 5c64f59 + 82411a1 + 89a0db6 + 6151be1 +  NOTHING
D/OpenGLRenderer(21678): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/Atlas   (21678): Validating map...
I/OpenGLRenderer(21678): Initialized EGL, version 1.4
D/OpenGLRenderer(21678): Enabling debug mode 0
I/Timeline(21678): Timeline: Activity_idle id: android.os.BinderProxy@26f1434d time:2867057
I/Choreographer(21678): Skipped 70 frames!  The application may be doing too much work on its main thread.
I/location(21678): startListening
I/location(21678): stopListening
I/location(21678): getLocation fail Location request timed out
I/location(21678): getLocation() fail Location request timed out
I/location(21678): getLocation() fail Location request timed out

Hi Baran,

Could you post your AndroidManifest.xml file here? I’m wondering if it is some kind of permissions issue.

Cheers

I can’t see anything wrong in the code. Have you tried increasing the timeout? Are you connected to Wifi and/or GPS? Have you checked the permissions for the app that they are set correctly?

Anders Bondehagen wrote:

I can’t see anything wrong in the code. Have you tried increasing the timeout? Are you connected to Wifi and/or GPS? Have you checked the permissions for the app that they are set correctly?

I connected Wifi and GPS. Every ten requests made turns into an answer. After the v0.28 it increased even more.

{
  "RootNamespace": "",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.GeoLocation",
    "Fuse.Maps"
  ],
  "Includes": [
    "*"
  ],
  "Android": {
    "Geo": {
      "ApiKey": "xxxxx"
    }
  }
}
```

Chris Bagley wrote:

Hi Baran,

Could you post your AndroidManifest.xml file here? I’m wondering if it is some kind of permissions issue.

Cheers

Where is AndroidManifest.xml in Fuse? Could you please tell me?

build/Android/Debug/<APPNAME>/app/src/main/bin/AndroidManifest.xml

(or the same for Release)

Remi Pedersen wrote:

build/Android/Debug/<APPNAME>/app/src/main/bin/AndroidManifest.xml

(or the same for Release)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.apps.location"
          android:versionCode="0"
          android:versionName="0.0.0">

    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
    <uses-feature android:glEsVersion="0x00020000"/>

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

    <application android:label="location"



                 android:icon="@mipmap/icon"
                 android:description="@string/description">

        <activity android:name="location"
                  android:label="location"
                  android:launchMode="singleTask"
                  android:theme="@style/AppTheme"
                  android:taskAffinity=""
                  android:windowSoftInputMode="adjustResize"
                  android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"



android:screenOrientation="user"

                  android:windowActionBar="false">
            <meta-data android:name="android.app.lib_name" android:value="location" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />



                
            </intent-filter>

            
        </activity>

        <activity android:name="Android_android_app_Activity"></activity>

        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <meta-data android:name="com.google.android.geo.API_KEY"
                   android:value="xxx"/>

    </application>
</manifest>
```

Well the permissions look ok in the manifest. You may want to double check on your device that the local permission hasnt been denied. Have you tried increasing the timeout?

Lastly, it should be unrelated but your maps API_KEY seems to be invalid. Try making a real key for that and see if anything changes. It should make no difference but stranger things have happened in google-land :stuck_out_tongue:

Chris Bagley wrote:

Well the permissions look ok in the manifest. You may want to double check on your device that the local permission hasnt been denied. Have you tried increasing the timeout?

Lastly, it should be unrelated but your maps API_KEY seems to be invalid. Try making a real key for that and see if anything changes. It should make no difference but stranger things have happened in google-land :stuck_out_tongue:

I have tried increasing the timeout. The result, I waited more before the error. :slight_smile:

I know API_KEY invalid. I hidden it. This problem very big problem for me. I have tried many different devices but same result. This problem has been since v0.20 (I get a timeout error on three to four queries.). However, the continuous error return started at v0.28.

So you say the last time this worked, was in 0.12.4? I have created an issue and we will investigate.

Thank you Anders.

A couple more sanity checks while we’re investigating:

Does this issue manifest even if you don’t reference Fuse.Maps/Include an API key?
When you check the app permissions (longpress-drag the app to the top left on recent versions of android) does it show location permissions as being granted?
What device(s) are you testing on?

I get the same error.
It worked perfectly ~4 hours ago.
Didn’t changed anything, didn’t updated anything.
The request is now getting timed out on my device.
Permissions are marked granted.

(I am testing on a Samsung Galaxy S5)

Dear Andreas,

  1. I already added reference Fuse.Maps and Include an API Key.
  2. All permission was granted.
  3. I am testing on a LG G3, a Sony Xperia Z1 and Asus Zenfone 2 Laser (Z00MD)

I’m also having issues with this. getLocation takes very long. Even increasing the timeout to 30 seconds does only result in success sometimes. This is both on local preview (Mac -> iOS simulator) as well as on the mobile device (Android).