React-native: Location request timed out on Android Emulator

Created on 4 Jul 2017  路  2Comments  路  Source: facebook/react-native

I am currently using Android Emulator but getting error as Location Request Timed Out when I try to fetch the location -

navigator.geolocation.getCurrentPosition(
(position) => {
console.log("position= " + position);
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: false, timeout: 20, maximumAge: 1000 }
);

and in AndroidManifest.xml - >
package="com.awesomeproject"
android:versionCode="1"
android:versionName="1.0">

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

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="22" />

<application
  android:name=".MainApplication"
  android:allowBackup="true"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  <meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="AIzaSyCzzBVaWQNBcwcVVYQwenZhj6cxi0zIft8"/>
</application>

Locked

All 2 comments

This issue looks like a question that would be best asked on StackOverflow.

StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on StackOverflow.

you phone is't support geolocation.so you must delete navigator.geolocation in you code.

Was this page helpful?
0 / 5 - 0 ratings