I'm developing a react-native mobile app an I would like to send an intent (geo: ...) specifically to google map app. In this native example they use the Intent.setPackage() function, but I can not find a similar solution for react-native.
Here's my code that currently let the user choose between possible apps. I would like that only google maps app manages the intent.
<Text
style={{ textDecorationLine: 'underline', color: PURPLE }}
onPress={async () => {
const scheme = Platform.select({ ios: 'maps:0,0?q=', android: 'geo:0,0?q=' });
const latLng = `${item.latitude},${item.longitude}`;
const label = item.address;
const url = Platform.select({
ios: `${scheme}${label}@${latLng}`,
android: `${scheme}${latLng}(${label})`
});
const supported = await Linking.canOpenURL(url);
if (supported) {
await Linking.openURL(url);
} else {
Alert.alert(`Don't know how to open current address`);
console.log('error opening link', url);
}
}
}
>
{context.translations.GO_TO_MAPS}
</Text>
Thanks for helping