updating geotag based on user's locattion

0 votes

i used the following code to setup geotags :
 

                StorageService storageService = App42API.BuildStorageService();
                
                storageService.SetGeoTag(gp);
                
                storageService.InsertJSONDocument(dbName, collectionName, jsonData, this);
               
how could i update this geotag when the user has moved to a new location  ?    
asked Oct 27, 2014 in App42 Cloud API-BaaS by Nipun Birla (18 points)
Could you please let us know in which platform and SDK version you are working on ? So that we can provide a code snippet to you.

Thanks,
Himanshu Sharma
Platform: Android
SDK: 3.8
Hi Pctronix,

This functionality works on all platforms, let me know if you need any help while integrating the same.

I will be happy to help you!!!

Regards,
Himanshu Sharma

1 Answer

+1 vote
 
Best answer

Hello Nipun,

Please find a below code snippet to update the geo data for your Unity app:

 

String dbName = "<Your_DataBase_Name>";

String collectionName = "<Your_Collection_Name>"; 

String docId = "docId";

Dictionary<string,object> keys = new Dictionary<string,object>();

keys.Add("loc","[49.33,24.67]");

App42Log.SetDebug(true);                //Print output in your editor console

storageService.AddOrUpdateKeys(dbName, collectionName, docId, keys, new UnityCallBack()); 

public class UnityCallBack : App42CallBack

{

            public void OnSuccess(object response)

            {

                        Storage storage = (Storage) response; 

                        App42Log.Console("dbName is " + storage.GetDbName());

                        App42Log.Console("collection Name is " + storage.GetCollectionName());

                        IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 

                        for(int i=0;i <jsonDocList.Count;i++)

                        {   

                                    App42Log.Console("objectId is " + jsonDocList[i].GetDocId());

                                    App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());

                                    App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());

                                    App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());

                        }  

            }

 

            public void OnException(Exception e)

            {

                        App42Log.Console("Exception : " + e);

            }

}

 

Let us know if it helps.

Thanks,

Himanshu Sharma

answered Oct 28, 2014 by hs00105 (2,005 points)
selected Nov 10, 2014 by Nipun Birla
Thanks Himanshu... i did it for WP8 SDK and the method worked perfectly :)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...