Ionic base64togallery plugin not working in android-targetSdkVersion 29

I’m using base64-to-gallery to save images for android devices in my ionic app.

Previously it was working fine but now after added <preference name="android-targetSdkVersion" value="29" />

to config.xml file, under the android platform, it’s not working.

Please kindly help me with i

finally able to solve it .

To anyone who is struggling, I will explain as below.

As mentioned in the git, GitHub - Nexxa/cordova-base64-to-gallery: this project is not longer maintained - Cordova plugin to save base64 data as a png image into the device , ionic Cordova base64togallery plugin has been discontinued.

And also when trying to submit the ionic mobile app for Android production, it’s saying that the target SDK version should be more than 29.

But as usual, if we add <preference name="android-targetSdkVersion" value="29" /> to the config.xml file under the Android platform, it will not work the base64togallery plugin (not saving images to your device)

So you have to do like below,

In your ionic project, go to build.gradle file ( platforms\android\build.gradle ) and change defaultTargetSdkVersion and defaultCompileSdkVersion to 29. (as below)


And then go to AndroidManifest.xml file ( platforms\android\app\src\main\AndroidManifest.xml ) and add android:requestLegacyExternalStorage="true" to the application tag, as showing below.

<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true">

Then try to build your app for debug or release versions.

checkout this link it’s work for me :grinning: