Open jeremy-power opened 4 years ago
content://com.nymi.nbeservice
is not the package name of the app you are calling, it will invoke whatever has registered an intent filter for that data object, in this case TickTick. Here is an example of calling via an explicit intent: https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L81. Also, your colleague seems to be doing something very similar, https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/115
Hi thank you very much for the response. It is true my coworker and I are working on the same issue but I thought this was a separate enough problem that it should be in a separate issue for anyone searching the problem.
I understand now where to put the package name, but I am now getting web intent error: Error
These are my current web intent options.
This is the manifest of the app I am trying to send intent to:
and these are the logs:
Thank you so much for your help, Jeremy Power
You may get a more verbose error message if you access the plugin directly rather than going through WebIntent, (
Do you have documentation for what you are trying to call? How would you call this with a native app?
This is how the intent is sent natively inside the app I am trying to send the same intent to externally.
I am sorry if this is vague, I am new to intents and I do not have very good documentation to go off of.
Also could you expand on the more verbose error message?
I can't seem to get that syntax to work, perhaps because I am using capacitor and not cordova.
Thank you so much for the help,
Jeremy
It looks like you will need to fork and modify this plugin.
The plugin does not support either getLaunchIntentForPackage(...)
or startForegroundService
. There is a good case for adding these but I have no immediate plans to do so myself.
The other observation is you are not specifying the component in your javascript: https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/blob/master/src/android/IntentShim.java#L499 but even if you specified it, you can't call startForegroundService.
Hi @darryncampbell , We forked the plugin to add the two methods we needed, but we are unable to use startForeground service. It does not show any error either. Here is the code we are trying. Similar code (except cordova line works in android native). Can you please advise any other changes?
Intent i = new Intent();
i.setComponent(new ComponentName(NBE_SERVICE_PACKAGE_NAME, NBE_SERVICE_CLS_NAME));
i.putExtra(AGENT_IP, "192.168.2.11");
i.putExtra(AGENT_PORT, "1234");
Context context=this.cordova.getActivity().getApplicationContext();
context.startForegroundService(i);
//set result
cordova.getActivity().setResult(Activity.RESULT_OK, result);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
//finish the activity
cordova.getActivity().finish();
Thanks, Sohel
I don't know... it seems to match the native code you put earlier that worked. Have you tried just putting the startService bit and see if that works:
Intent i = new Intent();
i.setComponent(new ComponentName(NBE_SERVICE_PACKAGE_NAME, NBE_SERVICE_CLS_NAME));
i.putExtra(AGENT_IP, "192.168.2.11");
i.putExtra(AGENT_PORT, "1234");
Context context=this.cordova.getActivity().getApplicationContext();
context.startForegroundService(i);
Thanks @darryncampbell , yes i tried startService, did not work...no error etc in log...
I also tried following but could not compile as could not find android support class ContextCompat // Intent serviceIntent = new Intent(); // serviceIntent.setComponent(new ComponentName(NBE_SERVICE_PACKAGE_NAME, NBE_SERVICE_CLS_NAME)); // serviceIntent.putExtra(AGENT_IP, "192.168.2.11"); // serviceIntent.putExtra(AGENT_PORT, "1234"); // ContextCompat.startForegroundService(this.cordova.getActivity(), serviceIntent);
Any other place/forum/specs to seek help on this issue?
Thanks, Sohel
According to your image at https://user-images.githubusercontent.com/17508664/90535322-c52a4c80-e148-11ea-9747-094e57b516c6.png the service needs to have been granted some permissions before you can call the service, have you tried implementing that entire code block?
You might try reaching out to the program author for more help
Thanks @darryncampbell issue resolved, it needs SDK level > 26 to work. So it is not working on some phones. Trying to see if we can check this in code to give a proper error message when it will not work. I wonder why cordova does not log such issues.
Thanks a lot
Eureka! Typically you should surround code with if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.X)
if it is an API that only works on certain Android versions, then you can log an error if the Android version is not high enough, so it is not really something Cordova would typically check for in the framework
Hey Darryn,
I am trying to start another activity with some simple extras, however I am unsure where to point to the specific application.
Currently it is defined as such:
(The app I am trying to open is com.nymi.nbeservice) However, this is causing a completely separate app to open called TickTick (no idea how).
The logs are here:
Hope you can take a quick look and let me know what I'm doing wrong.
Thanks so much,
Jeremy Power