You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Filip Maj (Created) (JIRA)" <ji...@apache.org> on 2012/03/16 00:32:37 UTC

[jira] [Created] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Adding a new Contact associated to a Google Android account will fire error callback
------------------------------------------------------------------------------------

                 Key: CB-344
                 URL: https://issues.apache.org/jira/browse/CB-344
             Project: Apache Callback
          Issue Type: Bug
          Components: Android
    Affects Versions: 1.5.0
         Environment: Android devices synchronized to a Google account. NOT AFFECTED: Android devices *not* synchronized to a Google account.
            Reporter: Filip Maj
            Assignee: Joe Bowser


For Android devices sync'ed to a Google account, the native framework will end up, by default, creating and adding a new contact to the Google account. However, there is an issue with the current implementation. The way the Contact Manager class executes the {{save}} method, it [runs through the motions of saving, then when that completes, tries to retrieve the newly-created contact immediately|https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91].

The issue arises when [checking for the newly-created contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to be happening behind the scenes is there is a delay between when the contact is saved, and when the contact becomes available/searchable (possibly due to cloud synchronization with Google services?). Therefore, trying to retrieve the contact immediately after creating it generally causes the error callback to fail. This behaviour is exhibited in [the mobile-spec contact save() test|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284].

Interestingly enough, on a device that is *not* associated to a Google account, this test passes every time.

Possibly worth investigating is whether contacts created and associated/saved to other types of accounts (Exchange?) exhibit the same problem.

One naive workaround that I can think of is to {{sleep}} in a {{while}} loop inside the {{save}} method in ContactManager until the contact is found, and then fire off the appropriate callback. However we want to make sure the PluginManager fires off {{save}} executions on a separate thread for this, probably.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Commented] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Posted by Andrew Grieve <ag...@chromium.org>.
Does that mean this is affected by network? Would adding a contact while
offline repro it reliably then?


On Tue, Aug 14, 2012 at 4:17 PM, Simon MacDonald (JIRA) <ji...@apache.org>wrote:

>
>     [
> https://issues.apache.org/jira/browse/CB-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434464#comment-13434464]
>
> Simon MacDonald commented on CB-344:
> ------------------------------------
>
> Well we did not change any of the native code. Basically it all depends on
> how fast your phone syncs with Google. If the contact is not synched by the
> time we are ready to return from the save command you can get a false
> failure.
>
> > Adding a new Contact associated to a Google Android account will fire
> error callback
> >
> ------------------------------------------------------------------------------------
> >
> >                 Key: CB-344
> >                 URL: https://issues.apache.org/jira/browse/CB-344
> >             Project: Apache Cordova
> >          Issue Type: Bug
> >          Components: Android
> >    Affects Versions: 1.5.0
> >         Environment: Android devices synchronized to a Google account.
> NOT AFFECTED: Android devices *not* synchronized to a Google account.
> >            Reporter: Filip Maj
> >            Assignee: Joe Bowser
> >             Fix For: Master
> >
> >
> > For Android devices sync'ed to a Google account, the native framework
> will end up, by default, creating and adding a new contact to the Google
> account. However, there is an issue with the current implementation. The
> way the Contact Manager class executes the {{save}} method, it [runs
> through the motions of saving, then when that completes, tries to retrieve
> the newly-created contact immediately|
> https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91
> ].
> > The issue arises when [checking for the newly-created
> contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to
> be happening behind the scenes is there is a delay between when the contact
> is saved, and when the contact becomes available/searchable (possibly due
> to cloud synchronization with Google services?). Therefore, trying to
> retrieve the contact immediately after creating it generally causes the
> error callback to fail. This behaviour is exhibited in [the mobile-spec
> contact save() test|
> https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284
> ].
> > Interestingly enough, on a device that is *not* associated to a Google
> account, this test passes every time.
> > Possibly worth investigating is whether contacts created and
> associated/saved to other types of accounts (Exchange?) exhibit the same
> problem.
> > One naive workaround that I can think of is to {{sleep}} in a {{while}}
> loop inside the {{save}} method in ContactManager until the contact is
> found, and then fire off the appropriate callback. However we want to make
> sure the PluginManager fires off {{save}} executions on a separate thread
> for this, probably.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators:
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>

[jira] [Commented] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Posted by "Braden Shepherdson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434408#comment-13434408 ] 

Braden Shepherdson commented on CB-344:
---------------------------------------

I can't reproduce this on my Galaxy Nexus, which is synced to three accounts. Nor on the 4.0 simulator, synced to none.

Does this bug still exist in recent Cordova versions?
                
> Adding a new Contact associated to a Google Android account will fire error callback
> ------------------------------------------------------------------------------------
>
>                 Key: CB-344
>                 URL: https://issues.apache.org/jira/browse/CB-344
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.5.0
>         Environment: Android devices synchronized to a Google account. NOT AFFECTED: Android devices *not* synchronized to a Google account.
>            Reporter: Filip Maj
>            Assignee: Joe Bowser
>             Fix For: Master
>
>
> For Android devices sync'ed to a Google account, the native framework will end up, by default, creating and adding a new contact to the Google account. However, there is an issue with the current implementation. The way the Contact Manager class executes the {{save}} method, it [runs through the motions of saving, then when that completes, tries to retrieve the newly-created contact immediately|https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91].
> The issue arises when [checking for the newly-created contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to be happening behind the scenes is there is a delay between when the contact is saved, and when the contact becomes available/searchable (possibly due to cloud synchronization with Google services?). Therefore, trying to retrieve the contact immediately after creating it generally causes the error callback to fail. This behaviour is exhibited in [the mobile-spec contact save() test|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284].
> Interestingly enough, on a device that is *not* associated to a Google account, this test passes every time.
> Possibly worth investigating is whether contacts created and associated/saved to other types of accounts (Exchange?) exhibit the same problem.
> One naive workaround that I can think of is to {{sleep}} in a {{while}} loop inside the {{save}} method in ContactManager until the contact is found, and then fire off the appropriate callback. However we want to make sure the PluginManager fires off {{save}} executions on a separate thread for this, probably.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Posted by "Joe Bowser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449971#comment-13449971 ] 

Joe Bowser commented on CB-344:
-------------------------------

Yes, that should reproduce it.  The connectivity in Vancouver was terrible enough that we didn't have to do this.
                
> Adding a new Contact associated to a Google Android account will fire error callback
> ------------------------------------------------------------------------------------
>
>                 Key: CB-344
>                 URL: https://issues.apache.org/jira/browse/CB-344
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.5.0
>         Environment: Android devices synchronized to a Google account. NOT AFFECTED: Android devices *not* synchronized to a Google account.
>            Reporter: Filip Maj
>            Assignee: Joe Bowser
>             Fix For: Master
>
>
> For Android devices sync'ed to a Google account, the native framework will end up, by default, creating and adding a new contact to the Google account. However, there is an issue with the current implementation. The way the Contact Manager class executes the {{save}} method, it [runs through the motions of saving, then when that completes, tries to retrieve the newly-created contact immediately|https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91].
> The issue arises when [checking for the newly-created contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to be happening behind the scenes is there is a delay between when the contact is saved, and when the contact becomes available/searchable (possibly due to cloud synchronization with Google services?). Therefore, trying to retrieve the contact immediately after creating it generally causes the error callback to fail. This behaviour is exhibited in [the mobile-spec contact save() test|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284].
> Interestingly enough, on a device that is *not* associated to a Google account, this test passes every time.
> Possibly worth investigating is whether contacts created and associated/saved to other types of accounts (Exchange?) exhibit the same problem.
> One naive workaround that I can think of is to {{sleep}} in a {{while}} loop inside the {{save}} method in ContactManager until the contact is found, and then fire off the appropriate callback. However we want to make sure the PluginManager fires off {{save}} executions on a separate thread for this, probably.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Posted by "Filip Maj (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj updated CB-344:
-------------------------

    Fix Version/s: Master
    
> Adding a new Contact associated to a Google Android account will fire error callback
> ------------------------------------------------------------------------------------
>
>                 Key: CB-344
>                 URL: https://issues.apache.org/jira/browse/CB-344
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.5.0
>         Environment: Android devices synchronized to a Google account. NOT AFFECTED: Android devices *not* synchronized to a Google account.
>            Reporter: Filip Maj
>            Assignee: Joe Bowser
>             Fix For: Master
>
>
> For Android devices sync'ed to a Google account, the native framework will end up, by default, creating and adding a new contact to the Google account. However, there is an issue with the current implementation. The way the Contact Manager class executes the {{save}} method, it [runs through the motions of saving, then when that completes, tries to retrieve the newly-created contact immediately|https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91].
> The issue arises when [checking for the newly-created contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to be happening behind the scenes is there is a delay between when the contact is saved, and when the contact becomes available/searchable (possibly due to cloud synchronization with Google services?). Therefore, trying to retrieve the contact immediately after creating it generally causes the error callback to fail. This behaviour is exhibited in [the mobile-spec contact save() test|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284].
> Interestingly enough, on a device that is *not* associated to a Google account, this test passes every time.
> Possibly worth investigating is whether contacts created and associated/saved to other types of accounts (Exchange?) exhibit the same problem.
> One naive workaround that I can think of is to {{sleep}} in a {{while}} loop inside the {{save}} method in ContactManager until the contact is found, and then fire off the appropriate callback. However we want to make sure the PluginManager fires off {{save}} executions on a separate thread for this, probably.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-344) Adding a new Contact associated to a Google Android account will fire error callback

Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434464#comment-13434464 ] 

Simon MacDonald commented on CB-344:
------------------------------------

Well we did not change any of the native code. Basically it all depends on how fast your phone syncs with Google. If the contact is not synched by the time we are ready to return from the save command you can get a false failure.
                
> Adding a new Contact associated to a Google Android account will fire error callback
> ------------------------------------------------------------------------------------
>
>                 Key: CB-344
>                 URL: https://issues.apache.org/jira/browse/CB-344
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.5.0
>         Environment: Android devices synchronized to a Google account. NOT AFFECTED: Android devices *not* synchronized to a Google account.
>            Reporter: Filip Maj
>            Assignee: Joe Bowser
>             Fix For: Master
>
>
> For Android devices sync'ed to a Google account, the native framework will end up, by default, creating and adding a new contact to the Google account. However, there is an issue with the current implementation. The way the Contact Manager class executes the {{save}} method, it [runs through the motions of saving, then when that completes, tries to retrieve the newly-created contact immediately|https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/ContactManager.java#L91].
> The issue arises when [checking for the newly-created contact|work/src/org/apache/cordova/ContactManager.java#L94]. What seems to be happening behind the scenes is there is a delay between when the contact is saved, and when the contact becomes available/searchable (possibly due to cloud synchronization with Google services?). Therefore, trying to retrieve the contact immediately after creating it generally causes the error callback to fail. This behaviour is exhibited in [the mobile-spec contact save() test|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/contacts.tests.js#L258-L284].
> Interestingly enough, on a device that is *not* associated to a Google account, this test passes every time.
> Possibly worth investigating is whether contacts created and associated/saved to other types of accounts (Exchange?) exhibit the same problem.
> One naive workaround that I can think of is to {{sleep}} in a {{while}} loop inside the {{save}} method in ContactManager until the contact is found, and then fire off the appropriate callback. However we want to make sure the PluginManager fires off {{save}} executions on a separate thread for this, probably.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira