danpickard
Posts: 0
Joined: Wed Feb 12, 2014 2:37 pm

is there a way to store a localstorage variable in the device data part of a database?

Basically when a user clicks on a radio button, I want the team that they have selected to be stored in an apperyDB that has no 'collection' in it. I've got this value stored in a local storage variable but I'm not sure how to post this data to an appery database once I've created the DB service

or maybe there's a way to clone the devices data table into a collection of my own automatically so when a new device registers with my app the device ID of this new device gets copied into a collection?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

is there a way to store a localstorage variable in the device data part of a database?

Hi Dan,

You can add a field in Database collection 'Devices'.

danpickard
Posts: 0
Joined: Wed Feb 12, 2014 2:37 pm

is there a way to store a localstorage variable in the device data part of a database?

I've done that and when I go to create a new database service all I get is the 'Files' collection to import.

Unless there's another way to post to a field in the DB?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

is there a way to store a localstorage variable in the device data part of a database?

Hi Dan.

It is not right to store user information in Devices collection as web users don't have a deviceId.

So, you can create new collection. And store data there with some deviceid what you can get from device or generate.

This collection would be custom. Therefore you will be able to access this collection via internal database services.

danpickard
Posts: 0
Joined: Wed Feb 12, 2014 2:37 pm

is there a way to store a localstorage variable in the device data part of a database?

ok, on device ready event i've tried using the following code to put the device ID into a label but it returns null. this was tried on an emulator

code var push = localStorage.getItem('pushNotificationDeviceID');
Appery('mobilelabel_2').text(push); /code

any ideas where i'm going wrong?

Return to “Issues”