title: Ionic Base64ToGallery - Error while saving image - Android
body: <p>I'm creating a chat app at the moment, similar to for example whats app and now I got problems with saving the Images on android with the error message: &quot;Error while saving image&quot;. On iOS all works without any problems.
  I'm getting the Image from the Server as a base64 string.
  I thought it maybe has to do something with the permissions but I checked them with @ionic-native/androidPermissions and this @ionic-nativ/diagnostics and both plugins told me that I got the required permissions.</p>
  <p>The Code of the Saving Image function:</p>
  <pre><code> savePhoto(base64String){
   this.base64ToGallery.base64ToGallery(base64String, {prefix: '_img', mediaScanner: true}).then(
      res =&gt; {
          console.log(&quot;Saved image to gallery:&quot;, res)
         //more code on this point, but shouldn't affect the base64 plugin
       },
      err =&gt; console.log('Error saving image to gallery:', err)
      )
  </code></pre>
  <p>Code of grantPermission with androidPermissions:</p>
  <pre><code>this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE).then(
        result =&gt; console.log(&quot;Has Permission?&quot;, result.hasPermission),
        err =&gt; this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE)
      )
  </code></pre>
  <p>Code with ionic diagnostics:</p>
  <pre><code>getStatusPermissionDiagnostics(){
      let successCallback = (isAvailable) =&gt; { console.log('Is available? ' + isAvailable); }
      let errorCallback = (e) =&gt; console.error(e);
      this.diagnostic.getExternalStorageAuthorizationStatus().then(
        successCallback).catch(errorCallback)
    }
  
  grantPermissionDiagnostics(){
      let successCallback = (isAvailable) =&gt; { console.log('Is available? ' + isAvailable); }
      let errorCallback = (e) =&gt; console.error(e);
      this.diagnostic.requestRuntimePermission(this.diagnostic.permission.WRITE_EXTERNAL_STORAGE).then(successCallback).catch(errorCallback)
    }
  </code></pre>
  <p>UPDATE:
  I now found out that this happens with Android 11 and 10, With Android Version 9 I got no problems at all.</p>