Start a new topic

Potential angular bug when on Android browser (offline)

I am using this to connect (using Angular library).

All works fine on IOS browser (Safari), desktop browser (Safari, Chrome) but fails on Android browser (webview)

var promise = $kinvey.init({

appKey: "abcdef",

appSecret: "abcdef",

sync: { enable: true, online: false}


if (navigator.onLine) {



However, if you do sync **enable: false, online:false**, it works fine on Android browser (webview).

Is there a problem here with the Angular library? Thanks!

It might help to put the `navigator.onLine` if-statement inside the `promise.then(...)` handler, since `$` depends on the library being initialized.
See the answer @Mark provided, depending on the Android version you are using, chances are navigator.isOnline has not yet registered when it hits your if statement. Try setting up an event listener and when the online event happens, then do

document.addEventListener("online", onOnline, false);

Thanks for your ideas. Sadly they are not helping though

Moved to using sync: { enable: true, online: navigator.onLine} because that is as per the Kinvey docs. (hence no longer using the before or after the promise)

I have a feeling its something to do with the persistence updates when doing a user update. I note the user update is quite different to a data update in the library. (one has res: true, one has req: true, res:true).......

What would be helpful would be reassurance that

a) { enable: true, online: navigator.onLine} on the init

b) var user_promise = $kinvey.User.update(user) (NO refresh:true , no offline:true..... I don't think required)

c) On Android, using Angular library

All works as a combination..... then I know its in my code. Right now I am still not sure if its my code, or the Angular library.

Anyone else got Android / Angular / Offline working as a combination?


I'm experiencing the same problem, Kinvey sync with angular works just fine in chrome while testing but doesn't work on android, I've also tried the above suggested solutions with no success.
For clarification / additional info I am testing on Android 4.2

Still pretty sure something is not quite right with local / net persistence returning to the update user function.....
When your app is offline, user entities cannot be updated using `$kinvey.User.update`. If you try to update anyway, a network request will be fired which will (obviously) fail.
Hi Mark

App very much online, just sync is in enabled state

According to the library code, should update online (which it does actually, looking at the data in the console), and then fall back to also saving locally (which is failing, I think, and forcing the app to quit the error is so strong)
Interesting, yes, it should update the local data when the update online succeeds. Since you mention the app just quits, can you get a hold of the actual error it quits upon?
Two more threads that MAYBE associated?

All with

- Angular library

- Android (works on IOS)

- Sync enabled (works when sync disabled)

Not saying they are all the same problem but its getting beyond a co-incidence that these 3 independently noted problems are all on the same functionality combination

The answer to all of this can be found on
Login or Signup to post a comment