DRDD2016 / sparkn2

0 stars 1 forks source link

Communicating between apps #51

Closed minaorangina closed 7 years ago

minaorangina commented 7 years ago

This issue is exploring the different ways that the spark app could launch/communicate with other apps on a user's phone.

Necessary for #58

Whatsapp's API docs Blog post Another blog post

minaorangina commented 7 years ago

Linking

React Native Linking lets you make contact with some external apps. This is dependent on finding a supported URL scheme for the app in question.

Also might need to make changes to the app's Info.plist to somehow register the app in question

22-12-2017 UPDATE Linking does not need to be manually linked; the documentation is out-of-date

Linking (and PushNotificationsIOS) are two examples of React Native libraries that need to be manually linked in xcode to work. Instructions on how to do so here: #57

minaorangina commented 7 years ago

Whitelisting target app url scheme in project

You need to whitelist the url for your target app (Whatsapp in our case) in the project's Info.plist file. Find the Info.plist under:

 /ios/[project name]/Info.plist

In the Info.plist, add the following code, inside <plist><dict>...</dict></plist>:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>[your app url scheme name]</string>
    </array>
  </dict>
</array>

In the case of WhatsApp, this would be:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>whatsapp</string>
    </array>
  </dict>
</array>
minaorangina commented 7 years ago

This issue was moved to DRDD2016/native#37