react-native-share / react-native-share

Social share, sending simple data to other apps.

Home Page:https://react-native-share.github.io/react-native-share

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Android] shareSingle opens Play Store instead of the installed app (WhatsApp)

dhatGuy opened this issue · comments

Steps to reproduce

  1. Call shareSingle with the following parameters:
Share.shareSingle({
  title: 'My Share Title',
  message: 'Check out this cool link!',
  url: 'https://example.com',
  social: Share.Social.WhatsApp,
})
.then((result) => {
  // Handle the result
})
  1. The Play Store page for the social app opens, even if the app is installed.

Expected behavior

The shareSingle method should directly open the installed WhatsApp app for sharing, rather than redirecting to the Play Store.

Actual behavior

The shareSingle method currently opens the Play Store page for WhatsApp app, regardless of whether the app is already installed on the device.

Environment

  • React Native version: 0.73.2
  • React Native platform + platform version: Android 13
  • Typescript version (if using typescript): 5.3.3

react-native-share

Version: 9.4.1

In AndroidManifest.xml use com.whatsapp instead of com.whatsapp.android

<queries>
    <package android:name="com.whatsapp" />
</queries>

If you are checking for package installation check with com.whatsapp

await Share.isPackageInstalled(
     'com.whatsapp'  ,
);