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

sendResult doesn't allow extras to be sent as non-string values #67

Closed cabaird closed 4 years ago

cabaird commented 5 years ago

Currently, when calling sendResult, any extras that are sent in are sent as strings. We'd like to be able to send these as booleans and ints as well. I believe a similar issue was fixed for startActivity, in #41.

darryncampbell commented 5 years ago

Hi, You can do something like the following:

window.plugins.intentShim.sendResult(
            {
                extras: {
                    'Test Intent Bundle': {
                            'ImAnInt': 5
                        }
                    }
            },
            function()  { }
        );
cabaird commented 5 years ago

@darryncampbell

Hi, You can do something like the following:

window.plugins.intentShim.sendResult(
            {
                extras: {
                    'Test Intent Bundle': {
                            'ImAnInt': 5
                        }
                    }
            },
            function()  { }
        );

By this you mean, if the value is in a bundle, it will be sent as an int correctly?

darryncampbell commented 5 years ago

Hi, yes, with the current implementation you can send either a string extra or a bundle extra back to the calling app. In the bundle extra you can include ints or bools. Is that sufficient or do you need to be able to send ints / bools that are not in a bundle?

cabaird commented 5 years ago

I do see that ints and booleans are working as expected as extras when using the startActivity and startActivityForResult methods. I would think we'd want these to be consistent ultimately.

As a temporary solution, we can make it work, but ideally, we'd like to send int and boolean extras. We're trying to use this for a dynamic solution, so a fix for this would allow for more options on our end.

darryncampbell commented 5 years ago

OK, thanks for the feedback. I have marked this as todo.

darryncampbell commented 5 years ago

Addressed in 1.1.5