Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"passive" location provider requires ACCESS_FINE_LOCATION permission #22

Open
mojtabadarzi opened this issue Jan 9, 2021 · 2 comments

Comments

@mojtabadarzi
Copy link

mojtabadarzi commented Jan 9, 2021

export default function App() {

  useEffect(() => {
    if (Platform === 'android') {
      PermissionsAndroid.requestMultiple(
        [
          PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
          PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
        ],
        {
          title: 'Give Location Permission',
          message: 'App needs location permission to find your position.',
        }
      )
        .then((granted) => {
          console.log(granted);
          resolve();
        })
        .catch((err) => {
          console.warn(err);
          reject(err);
        });
    }
  });
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.container}>
        <Mapir
          apiKey={"YOUR_MAPIR_API_KEY"}
          style={styles.container}
        >
          <Mapir.Camera
            zoomLevel={13}
            centerCoordinate={[51.422548, 35.732573]}
          />
          <Mapir.UserLocation
            onUpdate={(e) => {
              console.log(e);
            }}
          />
        </Mapir>
      </View>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

i added this permission to AndroidManifest.xml

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

but i have error yet!

@mojtabadarzi mojtabadarzi changed the title "passive" location provider requires ACCES_FINE_LOCATION permission "passive" location provider requires ACCESS_FINE_LOCATION permission Jan 9, 2021
@ReyhaneMasumi
Copy link
Member

Everything seems OK. Do you try clean Build?
If you test this on Emulator, maybe you should test it on a real device!

@mojtabadarzi
Copy link
Author

first must be checked if app has permission show user location component , but you didn't write this check in your doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants