Android ObjectsThe ParseObjectSaving ObjectsRetrieving - TopicsExpress



          

Android ObjectsThe ParseObjectSaving ObjectsRetrieving ObjectsThe Local DatastoreSaving Objects OfflineUpdating ObjectsDeleting ObjectsRelational DataData TypesQueriesSubclassesFilesAnalyticsConfigPush NotificationsLocal DatastoreUsersRolesFacebook UsersTwitter UsersCloud FunctionsGeoPointsUser InterfaceHandling ErrorsSecurity .NETJavaScriptPHPUnityREST APICloud CodeCloud ModulesHostingRelationsData & SecurityDownloadsAPI LibrariesTutorialsVideos Useful Resources QuickStart GuideAPI ReferenceTutorials Android Guide If you havent installed the SDK yet, please head over to the QuickStart guide to get our SDK up and running in Eclipse. You can also check out our API Reference for more detailed information about our SDK. Introduction The Parse platform provides a complete backend solution for your mobile application. Our goal is to totally eliminate the need for writing server code or maintaining servers. If youre familiar with web frameworks like Ruby on Rails, weve taken many of the same principles and applied them to our platform. In particular, our SDK is ready to use out of the box with minimal configuration on your part. Apps On Parse, you create an App for each of your mobile applications. Each App has its own application id and client key that you apply to your SDK install. Your account on Parse can accommodate multiple Apps. This is useful even if you have one application, since you can deploy different versions for test and production. Objects The ParseObject Storing data on Parse is built around theParseObject. Each ParseObjectcontains key-value pairs of JSON-compatible data. This data is schemaless, which means that you dont need to specify ahead of time what keys exist on each ParseObject. You simply set whatever key-value pairs you want, and our backend will store it. For example, lets say youre tracking high scores for a game. A singleParseObject could contain: score: 1337, playerName: Sean Plott, cheatMode: false Keys must be alphanumeric strings. Values can be strings, numbers, booleans, or even arrays and objects - anything that can be JSON-encoded. Each ParseObject has a class name that you can use to distinguish different sorts of data. For example, we could call the high score object a GameScore. We recommend that you NameYourClassesLikeThis and nameYourKeysLikeThis, just to keep your code looking pretty. Saving Objects Lets say you want to save theGameScore described above to the Parse Cloud. The interface is similar to a Map, plus the saveInBackground method: ParseObject gameScore = new ParseObject(GameScore); gameScore.put(score, 1337); gameScore.put(playerName, Sean Plott); gameScore.put(cheatMode, false); gameScore.saveInBackground(); After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: objectId: xWMyZ4YEGZ, score: 1337, playerName: Sean Plott, cheatMode: false, createdAt:2011-06-10T18:33:42Z, updatedAt:2011-06-10T18:33:42Z There are two things to note here. You didnt have to configure or set up a new Class called GameScore before running this code. Your Parse app lazily creates this Class for you when it first encounters it. There are also a few fields you dont need to specify that are provided as a convenience. objectId is a unique identifier for each saved object.createdAt and updatedAt represent the time that each object was created and last modified in the cloud. Each of these fields is filled in by Parse, so they dont exist on a ParseObject until a save operation has completed. Retrieving Objects Saving data to the cloud is fun, but its even more fun to get that data out again. If you have the objectId, you can retrieve the whole ParseObject using aParseQuery: ....
Posted on: Sat, 25 Oct 2014 09:47:44 +0000

Recently Viewed Topics




© 2015