Sending Android Intents with an Action


#1

I would like to send an Intent to another app with an action and an extra parameter string.
This is roughly how you would achieve this natively in Java:

Intent intent = new Intent();
String parameterString = "some data";
int requestCode = 100;
intent.setAction("com.some.app.action.SOME_ACTION");
intent.putExtra("parameterString", parameterString);
startActivityForResult(intent, requestCode);

This would allow the external app to perform some action using the parameterString and return a response back to the original app when finished.

The problem is that I haven’t found a way to achieve this with Ionic. I tried https://github.com/lampaa/com.lampa.startapp but was only able to either 1) just open the app (via the package field) but not perform the action or 2) receive either a NoSuchFieldException or ActivityNotFoundException exception when passing in an intent or action. This plugin is pretty old and no longer maintained so I also tried https://ionicframework.com/docs/native/web-intent, however the onError callback was always fired and I was unable to get the app to even open.

Does the AndroidManifest.xml file need to be edited for sending intents as well as receiving them?

I’ve looked all over this forum and Google but was only able to find a few unanswered threads regarding this or a similar topic.

Has anyone found a solution to this? Assuming there isn’t one, how difficult would it be to create a custom plugin that would do this?