Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-whatsapp-stickers getting success but not exported to whatsapp or not working properly #81

Open
anirban-baisya opened this issue May 25, 2022 · 2 comments

Comments

@anirban-baisya
Copy link

1st go to :- node_modules > react-native-whatsapp-stickers > android > src> main > java > com > jobeso > RNWhatsAppStickers >RNWhatsAppStickersModule.java

2nd :- comment out below lines from @ReactMethod public void send(String identifier, String stickerPackName, Promise promise) { ... } section

try {
  Activity activity = getCurrentActivity();
  // ResolveInfo should = activity.getPackageManager().resolveActivity(intent, 0);
  // if (should != null) {
    activity.startActivityForResult(wintent, ADD_PACK);
    promise.resolve("OK");
  // } else {
  //   promise.resolve("OK, but not opened");
  // }
} catch (ActivityNotFoundException e) {
  promise.reject(ERROR_ADDING_STICKER_PACK, e);
} catch  (Exception e){
  promise.reject(ERROR_ADDING_STICKER_PACK, e);
}

@ReactNativeFan
Copy link

@anirban-baisya
I am having the same problem with react-native 0.69. I am not getting any information in debug mode.
did you find a solution or at least what was the problem?
Thanks.

@ReactNativeFan
Copy link

ReactNativeFan commented Jul 22, 2022

After debugging RNWhatsAppStickersModule.java, i found that the following activity was failing:

ResolveInfo should = activity.getPackageManager().resolveActivity(intent, 0);

The problem happens if you are targeting android 11 (API 30 or higher) which is the default settings for ReactNative 0.69.

Android 11 introduces new changes related to package visibility, which will require adding some intent in
"android/app/src/main/AndroidManifest.xml"

I solved the problem by adding the following intent before the "<application" markup

 <queries>
    <intent>
        <action android:name="android.intent.action.MAIN" />
    </intent>
</queries>

Rememebr "" is new markup and requires a recent version of gradle or you will get "Failed Linking" error.

I am using the following gradle recent versions:

gradle plugin: 7.2.1
add to "android/build.gradle"
classpath("com.android.tools.build:gradle:7.2.1")

gradle: 7.3.3
add to "android/gradle/wrapper/gradle-wrapper.properties"
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip

@Jobeso, you may want to update the install section for Android to have the new intent i mentioned earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants