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 130 forks source link

Plugin does not work on Android 11 #140

Open iglombardo opened 2 years ago

iglombardo commented 2 years ago

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

darryncampbell commented 2 years ago

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?

iglombardo commented 2 years ago

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

darryncampbell commented 2 years ago

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.

iglombardo commented 2 years ago

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>`
darryncampbell commented 2 years ago

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?