Hi there,
I want to use a regular Android SDK and hook it up to my Capacitor app. I saw the Mapbox example and tried building a plugin (also tried adding native code without a plugin) but I always get:
2020-11-12 19:10:34.093 8267-8355/com.app_name.app E/AndroidRuntime: FATAL EXCEPTION: CapacitorPlugins
Process: com.binity.app, PID: 8267
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.app_name.app.MainHereActivity (has extras) }
I followed this tutorial and took inspiration from the Mapbox example source code.
The Activity is there and created, I tried an empty activity as well as my real one, but it throws this error as soon as I use “startActivity” or “startActivityForResult”.
Example Code:
public class HereRoutingPlugin extends Plugin {
@PluginMethod
public void createHereRoute(PluginCall call) {
Double latitude = call.getDouble("lat");
Double longitude = call.getDouble("lng");
Intent intent = new Intent("com.app_name.app.MainHereActivity");
intent.putExtra("lat", latitude);
intent.putExtra("lng", longitude);
//startActivityForResult(call, intent, 1);
getActivity().startActivity(intent);
}
}
What am I missing?
Thanks!!