react-native-mapbox-navigation
react-native-mapbox-navigation copied to clipboard
Android - When set shouldSimulateRoute to false app is crashed when open the mapbox navigation.
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;
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"
`
Yes I have fixed the problem by check permission in android if simulate is false.
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!!
Please provide me with gradle.properties and Gradle wrapper version. And Android mainfest. And react native version. To help you ? @abazudosen



React Native version ==> 0.68.2
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'] ?: "" } }
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
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 ....