cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bnaya (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-8917) Add api/way to get plugins results even when Cordova activity restarts
Date Wed, 28 Oct 2015 05:09:27 GMT

    [ https://issues.apache.org/jira/browse/CB-8917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14977740#comment-14977740
] 

Bnaya commented on CB-8917:
---------------------------

Hey [~bowserj],

After upgrading to cordova 5/android platform 4 the results returning to the plugin.
But the webview is restarted so there is no js callback.

So what i did is that of the plugin see that the result callback is null, it saves the result
to the app Preference 
http://developer.android.com/reference/android/preference/Preference.html
And on my js code startup i'm reading that to my js code using this plugin
https://github.com/apla/me.apla.cordova.app-preferences
and deleting it.
This way we overcome the problem with the camera plugin that the webview tends to close when
the gallery/camera activities are opened. 

I think cordova should have built it way to get plugin results after restart.
it can be appended to the device ready event, and if the developer is looking for it he will
get it from there

> Add api/way to get plugins results even when Cordova activity restarts  
> ------------------------------------------------------------------------
>
>                 Key: CB-8917
>                 URL: https://issues.apache.org/jira/browse/CB-8917
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>            Reporter: Bnaya
>
> In android when you have a plugin that opens new activity the CordovaActivity will be
killed and you won't get the result from the plugin.
> The new activity will get the results but because the plugin objects are dead and the
webview reloaded you can get the data to the js callback.
> The most noticeable example is the camera plugin. (And maybe its the same with even more
platforms)
> possible solution for this is to add metadata to the device ready event with incoming
data from plugins.
> I see that this code:
> https://github.com/apache/cordova-android/blob/3.6.x/framework/src/org/apache/cordova/CordovaActivity.java#L779-L784
> is trying to do some recovery but from some reason
> ```
> if(callback != null) {  
> ```
> fails. maybe the plugins didn't loaded yet?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message