Passing large blobs of data to plugin as Base64 string


#1

'm trying to pass a Base64 string (about 50MB) containing a large configuration object from Ionic Capacitor to a NativePlugin method. If I pass a much smaller string (~1MB) I can hit the breakpoint on the Java code, but passing the string of 50MB doesn’t give any errors or gets to native land.

Is there a limit on the maximum size of the serialized object that can be passed? Is is possible to increase this limit?

Here are snippets of the code I have:

PppPlugin.configure({ cfg: config }).then(() => {
config = null; // memory cleanup
this.configStatus = 'Configured!';
});

ionic-plugin.ts:

declare global
{
    interface PluginRegistry {
         PppPlugin?: PppPluginPlugin;
    }
}

export interface PppPluginPlugin {
    configure(options: { cfg: string }): Promise<string>;
}

Java:

@NativePlugin()
public class PppPlugin extends Plugin {

    @PluginMethod()
    public void configure(PluginCall call) {
        String config = call.getString("cfg");
        boolean result = libppp.configure(config);

        if (result) {
            JSObject ret = new JSObject();
            ret.put("success", result);
            call.success(ret);
        }
}

#2

Good question, I don’t know. There has been some discussion about this and we definitely need/want to do this. Created an issue for you here: https://github.com/ionic-team/capacitor/issues/984