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

Android - When set shouldSimulateRoute to false app is crashed when open the mapbox navigation. #95

Open
ahmedelsayed11 opened this issue Jun 23, 2022 · 8 comments

Comments

@ahmedelsayed11
Copy link

When trying to implement this package in android and set shouldSimulateRoute to false when open the page of mopbox navigation the app is crashed i don't know why this is happen. Is somebody can help it will be appreciated.
in IOS it works fine but this happens in Android only!

"@homee/react-native-mapbox-navigation": "^1.1.0"
"react-native": "0.68.2"
"react": "17.0.2"

App.js

import React from 'react';
import {Text, View, StyleSheet} from 'react-native';
import MapboxNavigation from '@homee/react-native-mapbox-navigation';

const App = () => {
  return (
    <View style={styles.container}>
      <MapboxNavigation
        origin={[31.407516555348657, 30.02753965945932]}
        destination={[31.20725835904003, 30.010892742780463]}
        shouldSimulateRoute={false}
        showsEndOfRouteFeedback
        onLocationChange={event => {
          const {latitude, longitude} = event.nativeEvent;
        }}
        onRouteProgressChange={event => {
          const {
            distanceTraveled,
            durationRemaining,
            fractionTraveled,
            distanceRemaining,
          } = event.nativeEvent;
        }}
        onError={event => {
          const {message} = event.nativeEvent;
        }}
        onCancelNavigation={() => {
          console.log('Cancel Navigation.....');
          // User tapped the “X” cancel button in the nav UI
          // or canceled via the OS system tray on android.
          // Do whatever you need to here.
        }}
        onArrive={() => {
          // Called when you arrive at the destination.
        }}
      />
    </View>
  );
};

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

export default App;
@Cirff
Copy link

Cirff commented Jun 27, 2022

please make sure you added below in AndroidManifest.xml
<meta-data android:name="MAPBOX_ACCESS_TOKEN" android:value="your access key" /> inside below tag
<application android:name=".MainApplication" android:label="@string/app_name"
and not inside <activity android:name=".MainActivity"
`

@ahmedelsayed11
Copy link
Author

Yes I have fixed the problem by check permission in android if simulate is false.

@abazudosen
Copy link

Yes I have fixed the problem by check permission in android if simulate is false.

PLS HELP!!!

i followed the installation instructions but only worked on IOS, how were u able to get it work on Android. PLS HELP!!

@ahmedelsayed11
Copy link
Author

ahmedelsayed11 commented Jul 1, 2022

Please provide me with gradle.properties
and Gradle wrapper version.
And Android mainfest.
And react native version.
To help you ?
@abazudosen

@abazudosen
Copy link

Screenshot 2022-07-02 at 07 26 30 AM

Screenshot 2022-07-02 at 07 26 51 AM

Screenshot 2022-07-02 at 07 27 16 AM

React Native version ==> 0.68.2

@ahmedelsayed11
Copy link
Author

First in gradle.wrapper.properties change distributionUrl to https\://services.gradle.org/distributions/gradle-6.9-all.zip
And don't forger to request user permission in App.js or the app entry.
And don't forget to add in android/buid.gradle
maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' authentication { basic(BasicAuthentication) } credentials { username = "mapbox" password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "" } }

@Wilfrid3
Copy link

Yes I have fixed the problem by check permission in android if simulate is false.

Where are you check permission? in APP.js? I need help please

@SERCHAT
Copy link

SERCHAT commented Dec 10, 2023

I have the same issue. I open android studio and check for that error is related with fusion location. I give the required permission ACCESS_FINE_LOCATION and enable it from app settings and then open the app and app crashes. Can anyone help us ? Thank you ....

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

5 participants