darryncampbell-cordova-plugin-intent icon indicating copy to clipboard operation
darryncampbell-cordova-plugin-intent copied to clipboard

Plugin does not work on Android 11

Open iglombardo opened this issue 3 years ago • 5 comments

Anyone using this plugin on Android 11? Was any different configuration required? My app works on 10 but doesn't work on 11.

iglombardo avatar Jan 22 '22 16:01 iglombardo

Hi @iglombardo , I use https://github.com/darryncampbell/plugin-intent-api-exerciser to test this plugin and that app appears to work well on my Pixel phone running A12. What is it that does not work exactly? And, does https://github.com/darryncampbell/plugin-intent-api-exerciser work for you?

darryncampbell avatar Jan 24 '22 07:01 darryncampbell

Hi, @darryncampbell , Here's the function I'm using, and below is a link to a video working on Android 10 and the error on Android 11.

` function openDetkSgin(numero_oc) { if(typeof numero_oc == 'undefined') { numero_oc = '360739'; }

   window.plugins.intentShim.startActivity(
	{
		action: window.plugins.intentShim.ACTION_SEND,
		component:
			{
				"package": "com.vjnicacio.detksign",
				"class": "com.vjnicacio.detksign.MainActivity"
			},
		type: "text/*",
		extras: {
			//  Change this URL to a URL of an actual picture on your device
			'android.intent.extra.TEXT': numero_oc
		}
	},
	function() {},
	function() {alert('Failed to open URL via Android Intent')}
);

}`

Work

Not Work

iglombardo avatar Feb 01 '22 01:02 iglombardo

You might want to debug into the native code to see what exactly is causing the error: https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/blob/master/src/android/IntentShim.java#L77.

I have an example showing how to send an image in the exerciser app: https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L103 which seems to work. Usually these type of A11 issues are down to scoped storage, in my experience.

darryncampbell avatar Feb 01 '22 08:02 darryncampbell

Hi @darryncampbell , to work it was necessary to add this in manifest. In the logs of Android Studio it presented the message "PackageSetting{bcc13fc com.vjnicacio.detksign/10154} BLOCKED"

<queries> <intent> <action android:name="android.intent.action.SEND" /> <data android:mimeType="text/*" /> </intent> </queries>

iglombardo avatar Feb 03 '22 01:02 iglombardo

Great! thanks for replying back. Are you able to use https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config to make this update?

darryncampbell avatar Feb 03 '22 07:02 darryncampbell