Skip to content

Commit bbac5ff

Browse files
Initialize Sake before creating and retrieving records
Added Sake initialization and startup checks for record creation and retrieval.
1 parent 3f38886 commit bbac5ff

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Samples/StoreSavedGameAndRetrieve/sampleSaveGame.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ static gsi_bool SampleStoreSavedGame()
163163
// send off the CreateRecord request and then wait for a response via the callback
164164
// we pass 'newRecordId' for the userData so that we can set this in the callback
165165
printf(" Creating Sake record...\n");
166+
SAKE sake;
167+
// startup sake
168+
printf("Starting up Sake\n");
169+
SAKEStartupResult startupResult = sakeStartup(&sake);
170+
if(startupResult != SAKEStartupResult_SUCCESS)
171+
{
172+
printf("Startup failed: %d\n", startupResult);
173+
return 0;
174+
}
166175
request = sakeCreateRecord(sake, &recordData, SampleStoreSavedGameCallback, &newRecordId);
167176

168177
if(!request) // local issue prior to the request actually going out
@@ -206,6 +215,14 @@ static gsi_bool SampleRetrieveSavedGame()
206215
myRecordToRetrieve.mNumFields = 5;
207216

208217
printf(" Getting our Sake record...\n");
218+
printf("Starting up Sake\n");
219+
SAKE sake;
220+
SAKEStartupResult startupResult = sakeStartup(&sake);
221+
if(startupResult != SAKEStartupResult_SUCCESS)
222+
{
223+
printf("Startup failed: %d\n", startupResult);
224+
return 0;
225+
}
209226
// send off the GetMyRecords request and then wait for a response via the callback
210227
request = sakeGetMyRecords(sake, &myRecordToRetrieve, SampleRetrieveSavedGameCallback, &savedGameDataRetrieved);
211228

0 commit comments

Comments
 (0)