Open BootsBack opened 1 year ago
Maybe because it's a base64 image... If you use Android Studio, can you paste what logcat says?
line 274: final PendingIntent pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT);
change with this:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_IMMUTABLE); } else { pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT); }
Full code check attach file
line 274: final PendingIntent pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT);
change with this:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_IMMUTABLE); } else { pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT); }
Full code check attach file
You are awesome. Thank you very much it is working in Android 12 and the lower versions.
It is in the SocialSharing.java.txt, but you also have to change the pendingIntent.getIntentSender() to finalPendingIntent.getIntentSender()). This is in line 377 or 385
chooseIntent = Intent.createChooser(sendIntent, chooserTitle, finalPendingIntent.getIntentSender());
For those with an error if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {^ symbol: variable S Cannot resolve symbol 'S' :301
increase the compileSdkVersion
to 31
, source: https://stackoverflow.com/questions/65044161/build-failed-error-cannot-find-symbol-if-build-version-sdk-int-build-versio (For me 29
was causing issues).
Android 12 API Level 31 my app crash on click <\button onclick="window.plugins.socialsharing.share(null, 'Android filename', 'data:image/png;base64,R0lGODlhDAAMALMBAP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUKAAEALAAAAAAMAAwAQAQZMMhJK7iY4p3nlZ8XgmNlnibXdVqolmhcRQA7', null)">base64 image only<\/button>