How to send a text message via SMS containing a link to my app
P粉094351878
P粉094351878 2023-09-01 22:44:43
0
1
673
<p>I'm building a React Native app using Expo-managed workflows. If the user successfully invites others to sign up, I want them to get a free one-month trial of the premium version. I want the user to be able to enter their friend's phone number and then automatically send a text message to their friend containing a link to my app. I've set up the ability to send text messages. Now I'm trying to figure out how to include a link in the text message that will open the app if they already have it installed on their phone, otherwise it will redirect them to the app store or play store. I've read a lot about it and tried a few different approaches, but can't figure out how to do it. Does anyone know an easy way? </p>
P粉094351878
P粉094351878

reply all(1)
P粉004287665

You can use Share

from react-native
import { Share } from 'react-native';
//...
<Button
     title="分享"
     onPress={() => Share.share({
         message:
             `你的信息。 ${yourAppUrl}`,
     })}
/>

See alsoexpo-linking

import * as Linking from 'expo-linking';
Linking.openURL('https://appurl');
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template