darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 136 forks source link

problem using StartActivityForResult #16

Closed mnjadidi closed 6 years ago

mnjadidi commented 7 years ago

my code is

window.plugins.intentShim.startActivityForResult( { action: window.plugins.intentShim.ACTION_SEND, component: "another.app.com/.Activity.PaymentRequestActivity", extras: { 'authCode': '2817EB9BDD7tvnsisygchlxe25719E053340B10AC5316', } }, function(intent) { console.log('problem '); }, function() { console.log("StartActivityForResult failure"); });

and sample java code is:

Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("another.app.com", "another.app.com.Activity.PaymentRequestActivity")); intent.putExtra("authCode", "2817EB9BDD7tvnsisygchlxe25719E053340B10AC5316"); startActivityForResult(intent, result);

but my code not work,,

and component not opened

darryncampbell commented 7 years ago

You are specifying window.plugins.intentShim.ACTION_SEND but if you want the Java Intent.ACTION_MAIN then you should specify the string 'android.intent.action.MAIN', if I understand correctly.

mnjadidi commented 7 years ago

i used action: 'android.intent.action.MAIN',

but how i use another element: when is use: url: 'another.app.com.Activity.PaymentRequestActivity' debug app return 11-01 09:10:28.052: E/PluginManager(3202): java.lang.IllegalArgumentException: Relative URIs are not supported.

darryncampbell commented 6 years ago

I suspect that is because 'another.app.com.Activity.PaymentRequestActivity' is not a URL. For a couple of examples of StartActivityForResult please see the test app, https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js