React-Native: How to open google play store from react native app?

前端 未结 2 1039
遥遥无期
遥遥无期 2021-02-05 16:47

I am trying to find a way how to open the google play store with my application when the user is pressing a button inside of the react-native application. Is there a way how to

2条回答
  •  礼貌的吻别
    2021-02-05 17:18

    If people are too lazy to read through the annoyingly SPA dev docs of android:

    market://details?id=
    

    In react-native land:

    Linking.openURL("market://details?id=");
    

    Example:

    Linking.openURL("market://details?id=googoo.android.btgps");
    

    Edit: Make sure to import Linking in order to use it

    import { View, Text, StyleSheet, Linking } from 'react-native';
    

提交回复
热议问题