apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 210 forks source link

Promise interface of prefs.fetch('key') does not work on Android 4.x.x #91

Open sdurandeu opened 8 years ago

sdurandeu commented 8 years ago

Using the following method fails with the error: Error in Success callbackId: .... It does not call the fail callback.

// fetch the value for a key using promise
prefs.fetch ('key').then (ok, fail);

Instead, I used the non-promised version prefs.fetch (ok, fail, 'key'); and it worked successfully. I reviewed the implementation and it looks it cannot find a valid Promise object in this section. It seems like the global Promise is not supported in Android 4.

Let me know if I'm missing something. Not sure is actually an issue of the library, so feel free to close, but might be useful for reference.

Thanks!

apla commented 7 years ago

Promise interface will work only if you have a proper promise interface. Android 4.x is quite old and mostly not supports promises. Callback version should work every time.