Question

I can't figure out for the life of me whats up with this. I dunno if this is appMobi/phonegap centric, cause they have there own special ways of setting cookies, and handling them. But I have what seems to be a unique problem overall, and it only occurs in the process of actually writing a cookie for the first time. Or removing it if it exists which is kind of like writing it.

Anyway I have 2 functions that worked perfectly up til the point of introducing the cookies to them. But I need the cookies also as its part of a login check, and a handful of other things. So this is my issue.

I type my user/pass, hit login. get nothing. hit login again, works. I hit logout after being logged in, nothing works. hit it again.. works..

These are ajax driven functions as well. Dunno if that has anything to do with it or not, but in both cases cookies are being written in one shape form or another and thats when the functions seem to break in respect to the fact that I need to click the buttons that trigger them twice to get the desired effect despite them being a single click action.

If I remove the cookie lines from my functions everything works normally again without problem, with exception that the cookies are required to actually use half the stuff I am building. Also its a lone cookie being written with a numeric value.

Ideas?

AppMobi.cache.setCookie('AutoRemember', uid, 90);

This one line if its there, i have to double click for my functions to work, if its not there my functions work as expected..

a sample of one of my function would be (quickly typing one out here for example sake)

$('#buttonX').click(function(){
   url = 'http://www.domain.com';
   $.post(url, function(data)
   {
      if(data.status == "good")
      {
         AppMobi.cache.setCookie('AutoRemember', uid, 90);
         window.location = 'dashboard.html';
      }
   }, 'json')
});
Was it helpful?

Solution 2

Well, come to find out or as far as I can figure at least. This appears to be a glitch between browser and emulator more so than it is my coding. When I run the app in the sandboxed appMobi application from "Test Anywhere" things work as expected all around.

I will be opening up a bug ticked on appMobi where every they take bug reports and I will come back here with a link later so others may follow it as well when and if they come across a similar issue.

OTHER TIPS

Ah yes, I ran into the same thing. You'll need to download and init the local_bootstrap.js lib and something from "Develop In Eclipse For Android " (I downloaded the .zip "appMobi Cloud Services library for PhoneGap Android development"). I'm doing the Android app with Eclipse, and I assume you are too, your post didn't mention what IDE you were using.

The .zip file has a great readme.txt on where & what to copy (.java files, jar file, etc.)

found here: http://www.appmobi.com/?q=node/85

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top