EDIT: Solved - This was a coding error on my part. Once that was fixed, PlayerPrefs seem to be working fine. I've added a few playerprefs via PlayerPrefs.SetInt and then PlayerPrefs.Save and when I close the app by sliding my finger up and hitting the X to close the app, the settings are not there when I load up again on the device. Has anyone else had playerprefs working on Blackberry? I also found someone else that had an issue with PlayerPrefs: http://hutonggames.com/playmakerforum/index.php?topic=5021.0
Hey there! I haven't gotten a chance to look into this myself yet unfortunately. It would be awesome if you could submit this as a bug using the bug reporting system to get it into the queue of things that need looking at. It's easier for me to track things in the bug system rather than forum threads.
I'll submit it when I get home from work. I'm wondering if I'm doing it wrong though. I was under the impression you just set it and then save and that was it. Is there anything else I have to call?
It's working fine for me on my Z10. You're also doing a GetInt when you re-enter your app, right? GameManager.difficulty = PlayerPrefs.GetInt("savedDifficulty");
Thanks Daisy for your response. I relooked over my code and saw that I was changing the playerprefs on an NGUI value changed on a radio button group. Due to this, the whole entire group save was getting called overwriting my selection. By making this to on click, it worked. So it seems playerprefs are working, sorry for the mistake. Thanks to everyone.
Actually something is off here: I have this published as well, but it's not saving the data at all... the app works fine already on iOS and Android, so the code is ok: this is quite a problem because if people buy the non consumable items they don't really have that working Is there some memory option that has to be set for BB?
Sure, but there is nothing wrong with the code, it works on all other platforms: Code (csharp): public static void Save() { PlayerPrefs.SetInt("ammo", ammo); PlayerPrefs.SetInt("gold", gold); PlayerPrefs.SetString("last", System.DateTime.Now.Ticks.ToString ()); PlayerPrefs.SetFloat("music", AudioController.GetCategoryVolume("Music")); PlayerPrefs.SetFloat("sfx", AudioController.GetCategoryVolume("SFX")); PlayerPrefs.SetInt("double", doubleCoins ? 1 : 0); PlayerPrefs.SetInt("ads", hasAds ? 1 : 0); PlayerPrefs.Save(); } public static void Read() { ammo = PlayerPrefs.GetInt("ammo", 5); gold = PlayerPrefs.GetInt("gold", 100); AudioController.SetCategoryVolume("Music",PlayerPrefs.GetFloat("music", 0.5f)); AudioController.SetCategoryVolume("SFX",PlayerPrefs.GetFloat("sfx", 0.75f)); lastRun = System.TimeSpan.FromTicks(long.Parse(PlayerPrefs.GetString("last", System.DateTime.Now.Ticks.ToString()))); doubleCoins = (PlayerPrefs.GetInt("double", 0) == 0 ? false : true); hasAds = (PlayerPrefs.GetInt("ads", 1) == 0 ? false : true); } As you can see it's quite straight forward. These static methods are called here and there when needed, like when leaving the Settings screen, when switching from Menu to Game and viceversa, when any purchase is successful... and so on. Still banging my head on this one
Hmm I'm not sure either. You wrote it pretty much exactly how I did for mine. Only thing I could suggest at this point is put a Debug.Log line in those functions and see if they are hit. That was the problem with mine, they were never called or double called.
In such a case it wouldn't work on iOS and Android either Anyway I did find the solution: checking the file sharing box in the build settings has fixed the problem... no idea why :/
Hrm... that checkbox would enable the access_shared permission setting in the bar descriptor. https://developer.blackberry.com/na...pfund_accessing_restricted_functionality.html I will have to look into this, if this is the case then a note in our documentation will need to be added.