SOLVED: How do I fix the localstorage problem

Get help using Construct 2

Post » Thu May 21, 2015 2:44 pm

I am having trouble with the localStorage. I've read posts and saw tutorials but I can not solve the problem. Whenever I test the APK, the menu does not work. I would ask to check of the script I am attaching below and, if possible, to convert APK and then test the mobile / tablet. I am very grateful for any help. Thanks.

https://www.dropbox.com/s/hz3v5egze84hw ... .capx?dl=0
Last edited by RBuster on Fri May 22, 2015 6:06 pm, edited 1 time in total.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,051


Post » Thu May 21, 2015 8:16 pm

Hi @Lordshiva1948

Thanks but you didn't use local storage in this capx.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,051

Post » Fri May 22, 2015 10:43 am

Please, some help. I need to fix this to finish a demonstration.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,051

Post » Fri May 22, 2015 11:40 am

What is your issue exactly ?

All I can think about is the fact that you never save the new value of level.
So likely are missing an action "Local Storage - Set Item" in your Event Sheet 2 before the "Wait" action.
Set the key to "levelKey" as this is the key you load in your menu layout and set the value to the global variable "level".
Instead of a wait action, make an event "Local Storage - On item set" "levelKey" and in that event go to the menu layout.

Your even sheet 2 should look something like that :
Image

As for the compatibility with APK, I must admit I don't know if Intel XDK or Cordova have yet integrated support for Local Storage.
I know it works on Chrome for Android and Firefox for mobile, but I don't know about "native" applications. (They should as they are based on chrome though)
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,290
Reputation: 70,138

Post » Fri May 22, 2015 12:12 pm

Kyatric thanks I was going to say same thing here but, you bitten me to it
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Fri May 22, 2015 5:09 pm

Kyatric wrote:What is your issue exactly ?

All I can think about is the fact that you never save the new value of level.
So likely are missing an action "Local Storage - Set Item" in your Event Sheet 2 before the "Wait" action.
Set the key to "levelKey" as this is the key you load in your menu layout and set the value to the global variable "level".
Instead of a wait action, make an event "Local Storage - On item set" "levelKey" and in that event go to the menu layout.

Your even sheet 2 should look something like that :
Image


Thank you, Kyatric. I'll make these changes and test it again.

Kyatric wrote:As for the compatibility with APK, I must admit I don't know if Intel XDK or Cordova have yet integrated support for Local Storage.
I know it works on Chrome for Android and Firefox for mobile, but I don't know about "native" applications. (They should as they are based on chrome though)


Maybe @Ashley knows. Anyway, I'll try again and post here when it's over
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,051

Post » Fri May 22, 2015 6:06 pm

After the changes, I exported the project with Cordova and build the application on Intel XDK. It worked perfectly.

If anyone needs or wants to test the result, I am attaching bellow the final capx and the APK.

CAPX: https://www.dropbox.com/s/hz3v5egze84hw ... .capx?dl=0

APK: https://www.dropbox.com/s/4e1cimaw08itj ... m.apk?dl=0

Thank you @Kyatric for your help.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,051

Post » Fri Aug 07, 2015 1:31 am

@RenatoB @kyatric is there a way to get it to work in device for iOS?
B
21
S
10
G
4
Posts: 106
Reputation: 4,244

Post » Fri Aug 07, 2015 10:09 am

@adagar: As far as I'm aware it should work. Cordova is supposed to support such a feature.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,290
Reputation: 70,138

Next

Return to How do I....?

Who is online

Users browsing this forum: TL22, Yahoo [Bot] and 22 guests