Viktor Sec
Viktor Sec

Reputation: 3085

How to open default iOS apps from a React Native app?

I'm creating a React Native app and I'd like to be able to open default apps from it. Specifically:

I understand I can open the system maps with

<TouchableOpacity
  onPress={() =>
    Linking.openURL(`geo:${latitude},${longitude}`)}>
  <Text>Open Map</Text>
</TouchableOpacity>```

and similarly call openURL("tel:" + telephone) for phone number. (I omit error handling in the code snippet purposefully.)

Next, it should be necessary to update ios/Info.plist to allow these application query schemes. I tried putting this into it:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>geo</string>
  <string>tel</string>
</array>

I'm still getting EUNSPECIFIED errors. I guess that maybe I'm not supposed to put the LSApplicationQueriesSchemes keys as geo and tel. I was, however, unable to find out what should go in there.

Thanks!

Upvotes: 1

Views: 1109

Answers (1)

vinayr
vinayr

Reputation: 11244

  1. If you are using simulator then only web URLs can be tested. Other URLs require actual device for testing.
  2. geo is android only.

Upvotes: 1

Related Questions