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

前端 未结 2 1045
遥遥无期
遥遥无期 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:15

    You can use deeplinking to redirect your user from your app using this: https://developer.android.com/distribute/tools/promote/linking.html

    and the Linking API from react-native: http://facebook.github.io/react-native/docs/linking.html

    0 讨论(0)
  • 2021-02-05 17:18

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

    market://details?id=<package_name>
    

    In react-native land:

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

    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';
    
    0 讨论(0)
提交回复
热议问题