3

Currently my Unity game on Android allows people to upload their save file using Google Play Saved Games:

((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution("MY-GAME-DATA",
                        GooglePlayGames.BasicApi.DataSource.ReadCacheOrNetwork, GooglePlayGames.BasicApi.SavedGame.ConflictResolutionStrategy.UseMostRecentlySaved, OnAndroidSavedGameOpened);

And then the OnAndroidSavedGameOpened callback proceeds to read or write depending on what the player chose to do.

private void OnAndroidSavedGameOpened(SavedGameRequestStatus status, ISavedGameMetadata game) {
    if (status == SavedGameRequestStatus.Success) {
        if (areWeLoadingTheGame) {
            ((PlayGamesPlatform)Social.Active).SavedGame.ReadBinaryData(game, OnAndroidSavedGameDataRead);
        } else if (areWeSavingTheGame) {
            SavedGameMetadataUpdate update = new SavedGameMetadataUpdate.Builder().Build();
            ((PlayGamesPlatform)Social.Active).SavedGame.CommitUpdate(game, update, dataToSave ,OnAndroidSavedGameDataWritten);
        }
    }
}

I am about to launch a sequel to that game - so it's a different app. However, I would like to be able to download AND even upload the save file from the prequel - that is, I want both the prequel and sequel apps to be able to manipulate the exact save Saved Game file.

What are the detailed, proper steps to achieve this?

When working with iOS and iCloud, to do this you have to specify the same iCloud container for both apps in Xcode. What would be the equivalent for Android?

Saturn
  • 17,888
  • 49
  • 145
  • 271
  • https://stackoverflow.com/questions/34720063/share-files-between-two-apps-using-internal-storage – Leo Bartkus Oct 09 '18 at 22:21
  • @LeoBartkus that would change the userid and I would not be able to update the application https://stackoverflow.com/questions/33282246/android-app-cannot-update-from-market-after-shareduserid-added – Saturn Oct 10 '18 at 09:55
  • @Voldemort in this case [content provider](https://developer.android.com/guide/topics/providers/content-providers) can be your solution. – solikhver Oct 18 '18 at 20:41

0 Answers0