You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2014/07/09 10:52:04 UTC

[jira] [Commented] (CB-7104) Plugin results not transmitted back to devices (specially Samsung S4 and S5)

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

ASF GitHub Bot commented on CB-7104:
------------------------------------

GitHub user hnilsen opened a pull request:

    https://github.com/apache/cordova-android/pull/105

    [CB-7104] Fix for the missing plugin message

    Please have a look at this. This might not be the cleanest fix for [CB-7104], but it does the job. It will toggle only when messages are in the queue.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hnilsen/cordova-android 3.3.x

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-android/pull/105.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #105
    
----
commit ebb105aacd6140caa18f82727d831f4011ee3d16
Author: Håkon Nilsen <hn...@gmail.com>
Date:   2014-07-09T08:49:51Z

    [CB-7104] Fix for the missing plugin message

----


> Plugin results not transmitted back to devices (specially Samsung S4 and S5)
> ----------------------------------------------------------------------------
>
>                 Key: CB-7104
>                 URL: https://issues.apache.org/jira/browse/CB-7104
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.3.0
>            Reporter: Håkon Nilsen
>            Priority: Blocker
>              Labels: patch
>
> Our app relies heavily on Cordova plugins for communicating between JavaScript and native, and on certain devices these messages are not consistently sent back to the JavaScript API.
> I've tracked it down to a problem with webView.setNetworkAvailable()-usage in NativeToJsMessageQueue.java, and I have a suggestion for a fix.
> The problem with the current setup of (3.3.0) of NativeToJsMessageQueue seems to be that the online flag is toggled every time a plugin is fired, while webView.setNetworkAvailable(online) is only fired if the queue has messages.
> Since not all plugins have messages, the online flag can be toggled twice, and the online flag will be i.e. false for each time the command is run - which means Cordova won't send any messages.
> On Samsung S4 and S5 the hideKeyboard-event is slower or faster than other devices, which results in a doble toggle of the online flag. This leads to the following command being sent when there is a message in the queue:
> webView.setNetworkAvailable(false); // first message
> webView.setNetworkAvailable(false); // second message, which is not being sent
> webView.setNetworkAvailable(false); // third message, which will be sent
> For us it has been a terrible blocker, and I've made a change to the OnlineEventsBridgeMode in NativeToJsMessageQueue.java that addresses this.



--
This message was sent by Atlassian JIRA
(v6.2#6252)