I built a couple of plugins with capacitor to use native android features in my project (Ionic v6). They work fine when I test it with the command ionic cap run android -l --external
, but when I build an apk and install it they don’t work.
I tried adding the plugin class in the onCreate, as follows, but doesn’t work.
package cl.dcanje.pos;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.dcanje.plugins.nativeclick.NativeClickPlugin;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(NativeClickPlugin.class);
}
}
Here you can see the output when I call the function, using the live reload
and when I do it from the apk.