Global Data: This data is available on a large scale, that is, it is
available to your application regardless of where it is placed. For
instance, if Jane and Jill both place your game application on their
profile, the global data set and retrieved will be exactly the same
for both Jane and Jill's copy of the game. This could be useful for
storing something like High Scores.
Instance Data: This data is available only to the specific copy
(instance) of the game (app). So if Jane and Jill both place your game
on their profile, the game will be able to store unique data. In this
case, Jane's game cannot access Jill's game's unique data storage
(instance Data) and likewise. An example use for this may be if a game
requires the 'state' of the game to be saved or you would like to keep
High Scores separated for each instance.
Person App Data: relates to a data store for an individual with
relation to the app on a global scale. Meaning that both Jill and
Jane's copy of the game will be able to access the same data for a
Person, but other applications will not have access to your
application's data for that person. The key here is that you're
storing data under a person with relation to an app. So if you try to
access that data for the same person from a different app, it won't
exist. An example use would be 'High Scores for Jill' (or jane), or
allowing users to save their game.
On Nov 13, 12:42 pm, "Dustin.Jo...@gmail.com" <Dustin.Jo...@gmail.com>
wrote:
> Imagine you created a gameappand would like to storedatafor it.
>
> GlobalData: Thisdatais available on a large scale, that is, it is
> available to your application regardless of where it is placed. Forinstance, if Jane and Jill both place your game application on their
> profile, the globaldataset and retrieved will be exactly the same
> for both Jane and Jill's copy of the game. This could be useful for
> storing something like High Scores.
>
> InstanceData: Thisdatais available only to the specific copy
> (instance) of the game (app). So if Jane and Jill both place your game
> on their profile, the game will be able to store uniquedata. In this
> case, Jane's game cannot access Jill's game's uniquedatastorage
> (instanceData) and likewise. An example use for this may be if a game
> requires the 'state' of the game to be saved or you would like to keep
> High Scores separated for eachinstance.
>
> PersonAppData: relates to adatastore for an individual with
> relation to theappon a global scale. Meaning that both Jill and
> Jane's copy of the game will be able to access the samedatafor a
> Person, but other applications will not have access to your
> application'sdatafor that person. The key here is that you're
> storingdataunder a person with relation to anapp. So if you try to
> access thatdatafor the same person from a differentapp, it won't
> exist. An example use would be 'High Scores for Jill' (or jane), or
> allowing users to save their game.
>
> On Nov 10, 6:12 pm, Zach <zcox...@gmail.com> wrote:
>
> > I'm sure I'm just not looking in the right place, but I can't seem to
> > find any description of what the differences between the Global,
> >Instance, and Person versions of Persistentdataare. Can anyone
Another thing I noticed is that although there are methods in
opensocial.DataRequest to update the instance and personal app data,
but there isn't one for global. Is it to be assumed that this feature
is going to be added?
I think for your first question, you can do that by retrieving person
app data for OWNER_FRIENDS, so assuming you stored the high score jane,
and jill and jane are friends, jill should be able to grab jane's high
score. Correct me if I'm wrong.
The data comes back as a map object per the spec (for
newFetchPersonAppDataRequest) "When processed, returns a Map<PersonId
<http://code.google.com/apis/opensocial/docs/javascript/reference/opensocial.DataRequest.PersonId.html>>,
Map<String, String>> object."
So in your example you should be able to access the data by using
data[personID]["dataKeyName"]. Like I said I haven't figured out how to
iterate through these, so in order to grab the data for say
"OWNER_FRIENDS" I first make sure I have a list of owner friends ( from
newFetchPeopleRequest ) and then iterate through them and check to see
if a corresponding value exists in my appdata object. So I would do
something like this:
ownerFriends = ( get a list of friends using newFetchPeopleRequest then
get("key").getData() )
data = ( as you described below, a returned object from
newFetchPersonAppDataRequest )
ownerFriends.each( function(aPerson){ // note that each is a function of
collection which is returned by newFetchPeopleRequest
if( data[aPerson.getId()] != null ) {
// do something with data... can be accessed using
data[aPerson.getId()]["dataKey"]
}
});
This works for me for now, but I'd be in anyone's debt who could explain
map iteration.