- Home /
Sync PlayerPrefs Between Phone and Android Wear
Ok, This is a diffult one... maybe..
I made a game in Unity for Android. Works great. -Saves highscore -Save number of games played -Saves total cumulative score -Saves points spend (in game points are used to unlock characters) -Saves unlokced characters -Saves current character -other stuff..
I made an Android Wear version also. -Does the same stuff.
I had to use Android Studio to make an AW compatible app -An android wear app is a mobile app with the android wear apk embedded inside, when you sync with your android wear device, the AW version is transferred via the Google Android Wear app. But data is not synced after that.
So, if I get a highscore of 50 on the phone, it will only be on the phone. If I beat that high score on the watch, it will only be on the watch. same for all data, etc.
Is there a way, without cloud syncing because many android wear devices do not have this capability, to tranfser the playerprefs data between the two apps.
I am open to any option right now.
Can I sync playerprefs data between and phone and a watch?
Answer by abi-kr01 · Jun 05, 2015 at 01:52 PM
not the best solution .instead of writing data to playerpref you can write same data in text file in "application.persistent data path" and move that file around your devices.keep in mind that you have to go to root of app and retrieve that data and pass it around with wifi/blueTh../USB etc.you have to encrypt the data so nobody can crack/update it manually.
I am not ignoring this answer, but I am hesitant to accept it. It is one possibility, however the data transfer is probably the most crucial part, and therefore what is needed.
I am currenlty attenting to do a google cloud sync, as I believe more AW devices will support this now, my inital research indicated otherwise.
I will leave the question open to future answers, and if none are supplied, I will close this question. Thank you.
if you want to use cloud then you have n no of possibility. you can even create your own php server,cloud etc.
I am going to use the cloud save features in Google Play Services. I wanted to have the phone and watch talk directly to each other, but without creating my own plugin, I cannot do this.
Answer by applemaniac · Jun 09, 2015 at 08:32 AM
Instead of using PlayerPrefs you can also use SQlite to build a database, and read it with your different devices.
True, I guess my main question shoudl have been, "How can I make the phone and watch talk to each other. was looking for expert advice and examples, I guess, not just scenarios. I appreciate your input though, as I think I have decided how I will accomplish my goal; Google Play Services has a cloud save feature. I wanted direct communication, but this will have to do.
thanks
You can also have what you want (maybe more directly) by using a server / client structure. Using Unity's $$anonymous$$asterServer can also help you to do something nice. An easy tutorial : https://www.youtube.com/watch?v=GEnkgqSH51E