Local Storage do not work after compile with cocoon.io to Android (canvas+ mode)


Sorry my english is not good enough.
I have game project using construct 2. I used local storage and array for make select level. After running on browser it’s perfect working, level 1 unlocked and the other locked, when i play and get the scores it all saved perfectly, when i reload the browser all scores still saved corectly. But after compiled with cocoon.io canvas+ and installed on android, local storage is not working like on browser, when i start the game on android all level is unlocked and when i restart the game i lost my scores. Why local storage is not work on android? or it’s my fault? Can anyone help me about that issue?


have you try in dev app ?
how do you save array ?
i’m actualy saving and loading with :

window.local_get = function(val,def) // val = key , def = default value
	if(!(tmp = localStorage.getItem(val)))  { local_set(val,def); return def; }
	return JSON.parse(tmp);
window.local_set = function(val,v) // val = key,  v = data 
	localStorage.setItem(val, JSON.stringify(v));


@Jerem I try in dev app but still same result.
How can I get the code like you above?


i m sorry , i dont know how construct work, i give you my functions but i m not using construct
sorry if this cant help


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.