Problems with persisting storage on Gingerbread when packaged as phonegap app.

91 views
Skip to first unread message

David Wright

unread,
Sep 23, 2013, 5:36:23 PM9/23/13
to ampl...@googlegroups.com
This is a general cry for help because I'm not entirely sure where things are falling apart.

I'm using amplify.request with cache: persist. This works as expected in chrome, while doing my basic testing and on my phone (jellybean) when bundled as a phonegap app, however, on my boss's gingerbread phone the app is not storing the data and makes the ajax call every time. Are there some console logs I could sneak into amplify that could help point out where it's borking? I'm storing login info in the localStorage on the device and that works fine so I know it isn't a permissions issue. If I jump into settings and go to manage the app I can see that it is caching data I wonder if the phone is doing something to change something so that when amplify looks for local storage it doesn't see anything that matches so it goes and gets it again. I be that's it. Anyone have any ideas as to how I can check that?

David Wright

unread,
Sep 24, 2013, 5:19:18 PM9/24/13
to ampl...@googlegroups.com
Nobody?

David Wright

unread,
Sep 24, 2013, 5:39:52 PM9/24/13
to ampl...@googlegroups.com
Okay, so I've learned that it is storing but it's not looking/finding the stored data on successive calls. It ends up generating a new key.

Can I force the use of a particular key instead of the random one?

Doug Neiner

unread,
Sep 24, 2013, 5:45:06 PM9/24/13
to ampl...@googlegroups.com
Hey David!

The cache key is not random, it is built off the URL, including query string, that is being requested. Is it possible some data is changing in your request? The reason it wasn't working last week was due to jQuery adding to that URL. The fix was to remove the parts of the url that were changing so the key would be consistent.

The important thing to check is that the data you are sending and the url you are requesting remains the same. Let me know if that helps at all.

Doug
--
You received this message because you are subscribed to the Google Groups "Amplify" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amplifyjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

David Wright

unread,
Sep 24, 2013, 5:53:18 PM9/24/13
to amplifyjs
hmm, I'll see where it thinks it's going. It should be the same place each time. Think gingerbread could be adding it's own something or other to it? crazy that the exact same apk works in jellybean and the pre-packaged site works in my browser just fine. Thanks for the direction.



--
You received this message because you are subscribed to a topic in the Google Groups "Amplify" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/amplifyjs/cyjEbSMzsd4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to amplifyjs+...@googlegroups.com.

David Wright

unread,
Sep 25, 2013, 11:29:00 AM9/25/13
to ampl...@googlegroups.com
Chrome:
fresh:  http://<site>/account/?apikey=<api>&jsoncallback=jQuery203006638091779313982_1380121970454&[object Object] 
cached: http://<site>/account/?apikey=<api>&jsoncallback=jQuery2030020541927544400096_1380122017593&[object Object]
Jellybean:
fresh:  http://<site>/account/?apikey=<api>&jsoncallback=jQuery20309053368626628071_1380122095257&[object Object]
cached: http://<site>/account/?apikey=<api>&jsoncallback=jQuery203022274921694770455_1380122256711&[object Object]
Gingerbread:
fresh:  http://<site>/account/?apikey=<api>&jsoncallback=jQuery20303890476245433092_1380122394296&[object Object]
cached: http://<site>/account/?apikey=<api>&jsoncallback=jQuery20304503237335011363_1380122511718&[object Object]
^not cached but should be.
Got the links from adding a console log to amplify on line 632 (in the $.extend( ajaxSettings) in amplify.request.types.ajax). logging ajaxSettings.url

That all seems right, doesn't it? Should I be looking at something else?



On Tuesday, September 24, 2013 4:53:18 PM UTC-5, David Wright wrote:
hmm, I'll see where it thinks it's going. It should be the same place each time. Think gingerbread could be adding it's own something or other to it? crazy that the exact same apk works in jellybean and the pre-packaged site works in my browser just fine. Thanks for the direction.
On Tue, Sep 24, 2013 at 4:45 PM, Doug Neiner <dne...@appendto.com> wrote:
Hey David!

The cache key is not random, it is built off the URL, including query string, that is being requested. Is it possible some data is changing in your request? The reason it wasn't working last week was due to jQuery adding to that URL. The fix was to remove the parts of the url that were changing so the key would be consistent.

The important thing to check is that the data you are sending and the url you are requesting remains the same. Let me know if that helps at all.

Doug

On Tuesday, September 24, 2013 at 4:39 PM, David Wright wrote:

Okay, so I've learned that it is storing but it's not looking/finding the stored data on successive calls. It ends up generating a new key.

Can I force the use of a particular key instead of the random one?

On Tuesday, September 24, 2013 4:19:18 PM UTC-5, David Wright wrote:
Nobody?

On Monday, September 23, 2013 4:36:23 PM UTC-5, David Wright wrote:
This is a general cry for help because I'm not entirely sure where things are falling apart.

I'm using amplify.request with cache: persist. This works as expected in chrome, while doing my basic testing and on my phone (jellybean) when bundled as a phonegap app, however, on my boss's gingerbread phone the app is not storing the data and makes the ajax call every time. Are there some console logs I could sneak into amplify that could help point out where it's borking? I'm storing login info in the localStorage on the device and that works fine so I know it isn't a permissions issue. If I jump into settings and go to manage the app I can see that it is caching data I wonder if the phone is doing something to change something so that when amplify looks for local storage it doesn't see anything that matches so it goes and gets it again. I be that's it. Anyone have any ideas as to how I can check that?

--
You received this message because you are subscribed to the Google Groups "Amplify" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amplifyjs+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "Amplify" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/amplifyjs/cyjEbSMzsd4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to amplifyjs+unsubscribe@googlegroups.com.

Doug Neiner

unread,
Sep 26, 2013, 12:02:03 AM9/26/13
to ampl...@googlegroups.com
Hey David,

Didn't get a chance to look closer at this today. I'll respond tomorrow.

Doug
To unsubscribe from this group and stop receiving emails from it, send an email to amplifyjs+...@googlegroups.com.

Doug Neiner

unread,
Sep 26, 2013, 11:32:36 PM9/26/13
to ampl...@googlegroups.com
Hi David,

Feel free to ping me directly on Skype tomorrow as well, but I wanted to respond as promised.

The URL's look like they aren't the culprit, but there may be something else at play.

The cache key gets generated on line 757 and 758. The things to console log out would be the three items passed in to make that key: settings.resourceId, ajaxSettings.cacheURL(), ajaxSettings.data

If they are different, then a different key would be generated. Let me know how they differ between platforms.

Hope this path gets us to a solution for you.

Doug
To unsubscribe from this group and stop receiving emails from it, send an email to amplifyjs+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "Amplify" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/amplifyjs/cyjEbSMzsd4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to amplifyjs+...@googlegroups.com.

David Wright

unread,
Sep 27, 2013, 10:45:55 AM9/27/13
to ampl...@googlegroups.com
Thanks, Doug. I've updated the app and I'll shoot you the results as soon as my co-worker with the crap phone gets in.

David Wright

unread,
Sep 30, 2013, 10:20:54 AM9/30/13
to amplifyjs
Chrome Fresh:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&json[object Object]
ajaxSettings.data: undefined

Chrome Cached:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&json[object Object]
ajaxSettings.data: undefined

Jellybean Fresh:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&json[object Object]
ajaxSettings.data: undefined

Jellybean Cached:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&json[object Object]
ajaxSettings.data: undefined

Gingerbread Fresh:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&jsoncallback=jQuery20305632852427661419_1380550357658&[object Object]
ajaxSettings.data: undefined

Gingerbread Cached:
settings.resourceId: accounts
ajaxSettings.cacheURL(): http://<domain>/account/?apikey=<apikey>&jsoncallback=jQuery20303879988668486476_1380550644214&[object Object]
ajaxSettings.data: undefined
Reply all
Reply to author
Forward
0 new messages