{"_id":"@a3j/cordova-plugin-mx-dw-scan-intent","_rev":"2-6457dc77f33c6abb8e11bf0032069460","name":"@a3j/cordova-plugin-mx-dw-scan-intent","dist-tags":{"latest":"2.2.1"},"versions":{"2.2.0":{"name":"@a3j/cordova-plugin-mx-dw-scan-intent","version":"2.2.0","keywords":["ecosystem:cordova","cordova-android","Intent"],"author":{"name":"Darryn Campbell"},"license":"MIT","_id":"@a3j/cordova-plugin-mx-dw-scan-intent@2.2.0","maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"homepage":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent#readme","bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent/issues"},"dist":{"shasum":"12f3805cdee16e2938691effd174ebe02cc192d9","tarball":"https://registry.npmjs.org/@a3j/cordova-plugin-mx-dw-scan-intent/-/cordova-plugin-mx-dw-scan-intent-2.2.0.tgz","fileCount":9,"integrity":"sha512-7SDi86ND8Ph4ze1kImAvSf9Ti9/rJCxKYL5a1MhbhDf8bxWEgyhVz6U0AgVthYWN2/PXR4j0BhpZKkWrmT2dWA==","signatures":[{"sig":"MEQCIHghrKRFKi529cZhmtDiA4HMuXI2gAEo1gJudZmN6/QgAiAh4XQ6uQnpOjHkzQdzRmlOT5ePp0ZI45JMlW3Ghb/YaA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59860},"main":"intentShim.js","cordova":{"id":"com-darryncampbell-cordova-plugin-intent","platforms":["android"]},"gitHead":"a304075ccaefafe2fa473d566bfa9d24d5225616","_npmUser":{"name":"a3j","email":"alex@a3jgroup.com"},"repository":{"url":"git+https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent.git","type":"git"},"_npmVersion":"11.6.2","description":"General purpose intent shim layer for cordova appliations on Android.  Handles various techniques for sending and receiving intents.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cordova-plugin-mx-dw-scan-intent_2.2.0_1775321527437_0.23262766227802056","host":"s3://npm-registry-packages-npm-production"}},"2.2.1":{"name":"@a3j/cordova-plugin-mx-dw-scan-intent","version":"2.2.1","description":"General purpose intent shim layer for cordova appliations on Android.  Handles various techniques for sending and receiving intents.","main":"intentShim.js","cordova":{"id":"com-darryncampbell-cordova-plugin-intent","platforms":["android"]},"repository":{"type":"git","url":"git+https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent.git"},"keywords":["ecosystem:cordova","cordova-android","Intent"],"author":{"name":"Darryn Campbell"},"license":"MIT","gitHead":"f06284f463c05cbcfe97b3730ef79eee384ce981","_id":"@a3j/cordova-plugin-mx-dw-scan-intent@2.2.1","bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent/issues"},"homepage":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent#readme","_nodeVersion":"22.22.2","_npmVersion":"11.6.2","dist":{"integrity":"sha512-6Cv0r0esjpPAqsw7uED/Yb/inOfkTiGU5KUFa/Bb1aas8hFt1F87pgDUhyD6yEczDfgLpODUBnOVB4f9puecsQ==","shasum":"6b41638aec41d16e0e47623b45ad733f87a2fc16","tarball":"https://registry.npmjs.org/@a3j/cordova-plugin-mx-dw-scan-intent/-/cordova-plugin-mx-dw-scan-intent-2.2.1.tgz","fileCount":9,"unpackedSize":59808,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICUHZRtylMlB8ZhlqpZ5ZuR5TxwRpVWNFf+t1v9ONO78AiEAu36CSrtSa1eQBiKMzw7M3ofLYLiHUWM1jXhKk07YOTk="}]},"_npmUser":{"name":"a3j","email":"alex@a3jgroup.com"},"directories":{},"maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cordova-plugin-mx-dw-scan-intent_2.2.1_1787527622042_0.0897392705010247"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-04T16:52:07.351Z","modified":"2026-08-23T23:27:02.305Z","2.2.0":"2026-04-04T16:52:07.589Z","2.2.1":"2026-08-23T23:27:02.177Z"},"bugs":{"url":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent/issues"},"author":{"name":"Darryn Campbell"},"license":"MIT","homepage":"https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent#readme","keywords":["ecosystem:cordova","cordova-android","Intent"],"repository":{"type":"git","url":"git+https://gitlab.com/a3j/cordova-plugin-mx-dw-scan-intent.git"},"description":"General purpose intent shim layer for cordova appliations on Android.  Handles various techniques for sending and receiving intents.","maintainers":[{"name":"a3j","email":"alex@a3jgroup.com"}],"readme":"*Please be aware that this application / sample is provided as-is for demonstration purposes without any guarantee of support*\n=========================================================\n\n[![npm version](http://img.shields.io/npm/v/com-darryncampbell-cordova-plugin-intent.svg?style=flat-square)](https://npmjs.org/package/com-darryncampbell-cordova-plugin-intent \"View this project on npm\")\n[![npm downloads](http://img.shields.io/npm/dm/com-darryncampbell-cordova-plugin-intent.svg?style=flat-square)](https://npmjs.org/package/com-darryncampbell-cordova-plugin-intent \"View this project on npm\")\n[![npm downloads](http://img.shields.io/npm/dt/com-darryncampbell-cordova-plugin-intent.svg?style=flat-square)](https://npmjs.org/package/com-darryncampbell-cordova-plugin-intent \"View this project on npm\")\n[![npm licence](http://img.shields.io/npm/l/com-darryncampbell-cordova-plugin-intent.svg?style=flat-square)](https://npmjs.org/package/com-darryncampbell-cordova-plugin-intent \"View this project on npm\")\n\nNote: this is the current underlying implementation for https://www.npmjs.com/package/@ionic-native/web-intent and https://ionicframework.com/docs/native/web-intent/\n\n# Android X support\n- For Android X Support please use version >= [2.x.x](https://www.npmjs.com/package/com-darryncampbell-cordova-plugin-intent/v/2.0.0) \n- For Android Support Library please use version [1.3.x](https://www.npmjs.com/package/com-darryncampbell-cordova-plugin-intent/v/1.3.0)\n\n# Interaction with Camera Plugin\nIf you are installing this plugin along with cordova-plugin-camera you **MUST install cordova-plugin-camera first.**\n\n# Overview\nThis Cordova plugin provides a general purpose shim layer for the Android intent mechanism, exposing various ways to handle sending and receiving intents.\n\n## Credits\nThis project uses code released under the following MIT projects:\n- https://github.com/napolitano/cordova-plugin-intent (marked as no longer maintained)\n- https://github.com/Initsogar/cordova-webintent.git (no longer available on github but the project is forked here: https://github.com/darryncampbell/cordova-webintent)\nThis project is also released under MIT.  Credit is given in the code where appropriate\n\n## IntentShim\nThis plugin defines a `window.plugins.intentShim` object which provides an API for interacting with the Android intent mechanism on any Android device.\n\n## Testing / Example\nAn example application is available at https://github.com/darryncampbell/plugin-intent-api-exerciser to demonstrate the API and can be used to test the functionality.\n\n## Installation\n\n### Cordova Version < 7\n    cordova plugin add https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent.git\n\n### Cordova Version >= 7\n    cordova plugin add com-darryncampbell-cordova-plugin-intent\n\n## Use with PhoneGap\n\nPlease use the latest PhoneGap cli when including this plugin, please refer to [Issue 63](https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/63) for context. \n\n## Supported Platforms\n- Android\n\n## intentShim.registerBroadcastReceiver\n\nRegisters a broadcast receiver for the specified filters\n\n    window.plugins.intentShim.registerBroadcastReceiver(filters, callback);\n\n### Description\n\nThe `intentShim.registerBroadcastReceiver` function registers a dynamic broadcast receiver for the specified list of filters and invokes the specified callback when any of those filters are received\n\n### Example\n\nRegister a broadcast receiver for two filters:\n\n    window.plugins.intentShim.registerBroadcastReceiver({\n        filterActions: [\n            'com.darryncampbell.cordova.plugin.broadcastIntent.ACTION',\n            'com.darryncampbell.cordova.plugin.broadcastIntent.ACTION_2'\n            ]\n        },\n        function(intent) {\n            console.log('Received broadcast intent: ' + JSON.stringify(intent.extras));\n        }\n    );\n\n\n## intentShim.unregisterBroadcastReceiver\n\nUnregisters any BroadcastRecivers\n\n    window.plugins.intentShim.unregisterBroadcastReceiver();\n\n### Description\n\nThe `intentShim.unregisterBroadcastReceiver` function unregisters all broadcast receivers registered with `intentShim.registerBroadcastReceiver(filters, callback);`.  No further broadcasts will be received for any registered filter after this call.\n\n### Android Quirks\n\nThe developer is responsible for calling unregister / register when their application goes into the background or comes back to the foreground, if desired.\n\n### Example\n\nUnregister the broadcast receiver when the application receives an onPause event:\n\n    bindEvents: function() {\n        document.addEventListener('pause', this.onPause, false);\n    },\n    onPause: function()\n    {\n        window.plugins.intentShim.unregisterBroadcastReceiver();\n    }\n\n## intentShim.sendBroadcast\n\nSends a broadcast intent\n\n    window.plugins.intentShim.sendBroadcast(action, extras, successCallback, failureCallback);\n\n### Description\n\nThe `intentShim.sendBroadcast` function sends an Android broadcast intent with a specified action\n\n### Example\n\nSend a broadcast intent to a specified action that contains a random number in the extras\n\n    window.plugins.intentShim.startActivity(\n        {\n            action: \"com.darryncampbell.cordova.plugin.intent.ACTION\",\n            extras: {\n                    'random.number': Math.floor((Math.random() * 1000) + 1)\n            }\n        },\n        function() {},\n        function() {alert('Failed to open URL via Android Intent')}\n    );\n\n\n## intentShim.onIntent\n\nReturns the content of the intent used whenever the application activity is launched\n\n    window.plugins.intentShim.onIntent(callback);\n\n### Description\n\nThe `intentShim.onIntent` function returns the intent which launched the Activity and maps to the Android Activity's onNewIntent() method, https://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent).  The registered callback is invoked whenever the activity is launched\n\n### Android Quirks\n\nBy default the android application will be created with launch mode set to 'SingleTop'.  If you wish to change this to 'SingleTask' you can do so by modifying `config.xml` as follows:\n\n    <platform name=\"android\">\n        ...\n        <preference name=\"AndroidLaunchMode\" value=\"singleTask\"/>\n    </platform>\nSee https://www.mobomo.com/2011/06/android-understanding-activity-launchmode/ for more information on the differences between the two.\n\n### Example\n\nRegisters a callback to be invoked\n\n    window.plugins.intentShim.onIntent(function (intent) {\n        console.log('Received Intent: ' + JSON.stringify(intent.extras));\n    });\n\n## intentShim.startActivity\n\nStarts a new activity using an intent built from action, url, type, extras or some subset of those parameters\n\n    window.plugins.intentShim.startActivity(params, successCallback, failureCallback);\n\n### Description\n\nThe `intentShim.startActivity` function maps to Android's activity method startActivity, https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent) to launch a new activity.\n\n### Android Quirks\n\nSome common actions are defined as constants in the plugin, see below.\n\n### Examples\n\nLaunch the maps activity\n\n    window.plugins.intentShim.startActivity(\n    {\n        action: window.plugins.intentShim.ACTION_VIEW,\n        url: 'geo:0,0?q=London'\n    },\n    function() {},\n    function() {alert('Failed to open URL via Android Intent')}\n    );\n\nLaunch the web browser\n\n    window.plugins.intentShim.startActivity(\n    {\n        action: window.plugins.intentShim.ACTION_VIEW,\n        url: 'http://www.google.co.uk'\n    },\n    function() {},\n    function() {alert('Failed to open URL via Android Intent')}\n    );\n\n## intentShim.getIntent\n\nRetrieves the intent that launched the activity\n\n    window.plugins.intentShim.getIntent(resultCallback, failureCallback);\n\n### Description\n\nThe `intentShim.getIntent` function maps to Android's activity method getIntent, https://developer.android.com/reference/android/app/Activity.html#getIntent() to return the intent that started this activity.\n\n### Example\n\n    window.plugins.intentShim.getIntent(\n        function(intent)\n        {\n            console.log('Action' + JSON.stringify(intent.action));\n            var intentExtras = intent.extras;\n            if (intentExtras == null)\n                intentExtras = \"No extras in intent\";\n            console.log('Launch Intent Extras: ' + JSON.stringify(intentExtras));\n        },\n        function()\n        {\n            console.log('Error getting launch intent');\n        });\n\n\n## intentShim.startActivityForResult\n\nStarts a new activity and return the result to the application\n\n    window.plugins.intentShim.startActivityForResult(params, resultCallback, failureCallback);\n\n### Description\n\nThe `intentShim.startActivityForResult` function maps to Android's activity method startActivityForResult, https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int) to launch a new activity and the resulting data is returned via the resultCallback.\n\n### Android Quirks\n\nSome common actions are defined as constants in the plugin, see below.\n\n### Example\n\nPick an Android contact\n\n    window.plugins.intentShim.startActivityForResult(\n    {\n        action: window.plugins.intentShim.ACTION_PICK,\n        url: \"content://com.android.contacts/contacts\",\n        requestCode: 1\n    },\n    function(intent)\n    {\n        if (intent.extras.requestCode == 1)\n        {\n            console.log('Picked contact: ' + intent.data);\n        }\n    },\n    function()\n    {\n        console.log(\"StartActivityForResult failure\");\n    });\n\n## intentShim.sendResult\n\nAssuming this application was started with `intentShim.startActivityForResult`, send a result back\n\n    window.plugins.intentShim.sendResult(args, callback);\n\n### Description\n\nThe `intentShim.sendResult` function returns an `Activity.RESULT_OK` Intent to the activity that started this application, along with any extras that you want to send along (as `args.extras` object), and a `callback` function. It then calls Android Activity's finish() method, https://developer.android.com/reference/android/app/Activity.html#finish().\n\n### Android Quirks\n\nBoth `args` and `callback` arguments have to be provided. If you do not need the functionality, send an empty object and an empty function\n\n    window.plugins.intentShim.sendResult({}, function() {});\n\n### Example\n\n    window.plugins.intentShim.sendResult(\n        {\n            extras: {\n                'Test Intent': 'Successfully sent',\n                'Test Intent int': 42,\n                'Test Intent bool': true,\n                'Test Intent double': parseFloat(\"142.12\")\n            }\n        },\n        function() {\n        \n        }\n    );\n\n## intentShim.packageExists\nReturns a boolean indicating if a specific package is installed on the device.\n\n```js\nwindow.plugins.intentShim.packageExists(packageName, callback);\n```\n\n### Description\n\nThe `intentShim.packageExists` function returns a boolean indicating if a specific [package](https://developer.android.com/studio/build/configure-app-module#set_the_application_id) is installed on the current device.\n\n### Example\n```js\nconst packageName = 'com.android.contacts';\n\nwindow.plugins.intentShim.packageExists(packageName, (exists) => {\n    if (exists) {\n        console.log(`${packageName} exists!`);\n    } else {\n        console.log(`${packageName} does not exist...`);\n    }\n});\n```\n\n## Predefined Constants\n\nThe following constants are defined in the plugin for use in JavaScript\n- window.plugins.intentShim.ACTION_SEND\n- window.plugins.intentShim.ACTION_VIEW\n- window.plugins.intentShim.EXTRA_TEXT\n- window.plugins.intentShim.EXTRA_SUBJECT\n- window.plugins.intentShim.EXTRA_STREAM\n- window.plugins.intentShim.EXTRA_EMAIL\n- window.plugins.intentShim.ACTION_CALL\n- window.plugins.intentShim.ACTION_SENDTO\n- window.plugins.intentShim.ACTION_GET_CONTENT\n- window.plugins.intentShim.ACTION_PICK\n\n## Tested Versions\n\nTested with Cordova version 6.5.0 and Cordova Android version 6.2.1\n\n\n\n","readmeFilename":"README.md"}