SharedPreference support in cocos2d-x

SharedPreference support in cocos2d-x
0.0 0



Does cocos2d-x support the functionality of SharedPreference?
What I’ve seen is that there is CCUserDefault however, AFAIK, it writes a custom XML file thus requires SD card read/write permission on Android.
I’ve also heard that somebody made a version of CCUserDefault which uses a SharedPreference internally, however, AFAIK it is not included in the base cocos2d-x code.
Is this true? Or there is already SharedPreference support?


I don’t know somebody made a version of CCUserDefault which use SharedPreference internall.

BTW: The XML file is saved in /data/data/package-name/, not in SD card.


But doesn’t that require additional permissions on Android?


I have g10, which has not root permission, and the UserDefaultTest works ok.
So, I think it doesn’t require additinal permissions.


I meant app permissions. So it doesn’t require a permission like WRITE_EXTERNAL_STORAGE.
If not, then I’m happy with the XML based solution.


I haven’t add WRITE_EXTERNAL_STORAGE in xml. You can do a test, or you tell me what should I do to test it.


No, that should be enough. I was just afraid that I have to put some permission in the manifest.
Anyway, when I’ll reach the point in the development of my next game that I’ll need CCUserDefault, I’ll tell my impressions.


Ok, tell me if you have any problem.