EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 905 forks source link

Android 13 devices error on share with Twitter or Facebook #1200

Open juanico18 opened 1 year ago

juanico18 commented 1 year ago

After add `

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

The canShare let us share to Facebook, Whatsapp or Twitter.

But on share we have an exception for Facebook and Twitter

Fatal Exception: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.twitter.android/com.twitter.app.dm.DMActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2171) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805) at android.app.Activity.startActivityForResult(Activity.java:5583) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:647) at android.app.Activity.startActivityForResult(Activity.java:5541) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:628) at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:69) at nl.xservices.plugins.SocialSharing$2$1.run(SocialSharing.java:348)

And For facebook: Fatal Exception: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.facebook.katana/com.facebook.composer.shareintent.ImplicitShareIntentHandlerDefaultAlias}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2171) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805) at android.app.Activity.startActivityForResult(Activity.java:5583) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597) at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:352) at android.app.Activity.startActivityForResult(Activity.java:5541) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:583) at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:69) at nl.xservices.plugins.SocialSharing$2$1.run(SocialSharing.java:348)

I have done some research and it seems a problem just in Android 13.

I have tested changing AndroidManifest. https://developer.android.com/guide/components/intents-filters#ExampleFilters

But I have not been able to fix the problem

sujen2009 commented 1 year ago

I am having same issue. Any work around?

krishna711 commented 1 year ago

I too have same issue on Android 13 only. No work around found. I tried upgrading plugin to latest version 6.0.4.

SiempreProgramadorNovato commented 1 year ago

In my end app was crashing when sharing on any platform. I solved putting this on config.xml

    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/receiver[@android:name='nl.xservices.plugins.ShareChooserPendingIntent']">
        <activity android:exported="true" />
    </edit-config>
Samuel-Oliveira commented 1 year ago

Same Error Here.

EYALIN commented 1 year ago

@Samuel-Oliveira @SiempreProgramadorNovato @krishna711 @sujen2009 @juanico18 it has been fixed in my forked repo: https://github.com/EYALIN/community-cordova-plugin-social-sharing

you can install it as an npm package: cordova plugin add community-cordova-plugin-social-sharing --save

Niagawan-mave commented 9 months ago

The above plugin works !!! Just remove the original cordova-plugin-x-social-sharing, then install the one above