Page 1 of 1

Error saving data with pointer from a mobile App but works in Appery / browser mode

Posted: Fri Jul 18, 2014 11:58 am
by Shawn

Hi

Recently I introduced pointers into my DB and started encountering a strange problem.

I'm able to save records with pointers while I work on Appery and even using the Appery tester App.

However when I create an APK and run on Android it gives me an error.

This is my code to store a pointer value

var id = localStorage.getItem("udid");
return {"collName" : "userdetails", "_id" : id};

Not sure why this is happening.


Error saving data with pointer from a mobile App but works in Appery / browser mode

Posted: Fri Jul 18, 2014 1:15 pm
by Evgene Karachevtsev

Hello Shawn,

Please clarify, do you mean that the same code works in the browser, but does not work on the device? You should do alert(id) before return to be sure that the id is read correctly from local storage (and correctly was recorded there earlier).
Also please tell us what device do you use with what OS?


Error saving data with pointer from a mobile App but works in Appery / browser mode

Posted: Fri Jul 18, 2014 2:59 pm
by Shawn

Yes the code is the same. Works on the Web and fails when
running as an Android APK.

The Android App is running on a test phone which is a
Huwaei Y300 running Android 4.1.1. I've also got a BlueStacks
test environment on which it fails.

I will be debugging all values using Alert() to see and let you know.

One thing I noticed that I'm not always passing
X-Appery-Session-Token from stored local storage variable
could this be an issue ?


Error saving data with pointer from a mobile App but works in Appery / browser mode

Posted: Fri Jul 18, 2014 3:53 pm
by Shawn

ok sorry ... figured this out. it was the userid local storage variable wrongly set in my dev env as compared to the phone. thx for the direction.


Error saving data with pointer from a mobile App but works in Appery / browser mode

Posted: Fri Jul 18, 2014 3:57 pm
by Kateryna Grynko

Hi Shawn,

Thank you for the update. Glad you figured this out!