XDK .apk & Local Storage not working.

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.

    Ok, so I have my app loaded onto Google Play. I have it in closed beta.

    I've exported to Cordova, loaded the project into XDK and pushed the build to the server.

    When I run my app from app preview (Server App) on my Android device, local storage works as intended.

    So I do a Crosswalk build with XDK on the desktop, download the .zip files and then upload the .apk's to Google Play. I then download it via the play store download link and put it on my Android device... local storage doesn't work... at all.

    Any ideas?

    Is it maybe because I'm running it with app preview and have it installed as an app?

    Do I need to add any of the Cordova plugins to XDK?

    I'm attempting a non-Crosswalk build now but it'll be a few hours before Google makes it available. Could Crosswalk an Local Storage be an issue?

    I have no problems with LocalStorage on Crosswalk ...

    I don't either as long as I don't run it as an app installed from Google Play.

    Even the XDK emulator is reading the local storage properly.

    I did notice one thing though, when I built as an Android app the .apk size was like 2meg. As Crosswalk 20+ meg. Huge difference.

    I don't either as long as I don't run it as an app installed from Google Play.

    Even the XDK emulator is reading the local storage properly.

    I did notice one thing though, when I built as an Android app the .apk size was like 2meg. As Crosswalk 20+ meg. Huge difference.

    It might be an issue with local storage in combination with the webview..

    The Crosswalk export should however have no issues, because of the built in Chromium-browser..

    It might be an issue with local storage in combination with the webview..

    The Crosswalk export should however have no issues, because of the built in Chromium-browser..

    Ok, the webview I'm not familiar with.

    I do know that when I run the app in the XDK debug I can see the local storage keys and values. They look correct there too.

    Anytime the user changes an option, I'm saving it to a key in a dictionary and then immediately saving that dictionary as a .json through local storage. When the app starts up, local storage looks for the key/value for the .json and loads the dictionary from that. This method is obviously working in other settings.

    I also have a browser.close to exit the app. Before it closes, I check to see if local storage is processing sets and if it is, I have it wait 1 second and check again. If not, it closes the app.

    Could Google Play be somehow blocking the loading/saving of .json files??? None of this really makes sense to me.

    And I just got the Android-crosswalk build onto the device and still, no Local Storage

    And, though IAP isn't working in the Chrome Web Store so I have it in closed beta, I uploaded a Chrome Web export and, the local storage is working there as intended.

    When I built as an Android app the .apk size was like 2meg.

    This uses Webview

    As Crosswalk 20+ meg. Huge difference.

    This uses a built in browser and the browser is what makes the file big..

    This uses a built in browser and the browser is what makes the file big..

    Ok, I'll have to do some studying to find out which is best for my needs. It seems the Webview .apk is running a lot faster and smoother (which shouldn't be a surprise now that I now the difference.)

    But, speed does me no good if it can't save data.

    Ok, it's not Google Play, it must be somewhere in XDK. I just e-mailed the .apk to my Android device, ran it and... no local storage. But it does work when I push the build and run it from App Preview. I'm confused.

    Everything seems to run fine util I build the .apk. I haven't added any plugins in XDK. Is there one I should be adding specifically for Local Storage? None of the others seem to apply to anything I need except perhaps File and XDK file.

    Anyone? I'm at a dead stop here and out of ideas.

    Anyone? I'm at a dead stop here and out of ideas.

    Did you try if exporting to crosswalk works?

    (if you want to support devices with android below 4.4 you'll probably need it anyway)

    Like I said, maybe the webview of your device doesn't support local storage..

    This would mean inside IntelXDK preview it works, because they assume your device supports it..

    If all doesn't work, I found this on the interwebs:

    On this site:

    Local Database IntelXDK

    It says:

    What if WebView doesn’t support IndexedDB?

    Some browser don’t support IndexedDB. So you can include third-party IndexedDB plugin in your app. This plugin adds support for IndexedDB.

    That plugin can be found here:

    Cordova indexedDB

    Thanks LittleStain for looking into this. Neither of the plugins on that page resolved the issue. One of them I was only able to build in the 5.1.1 cli, the other (the async) I couldn't get to build at all, it kept throwing errors. I tried doing both a webview and a crosswalk build. No luck, still no local storage.

    Local Storage works in these situations

    Running on Local Host

    Exported to HTML5

    Running via the XDK Emulator

    Running in XDK App Preview

    It does not work when built into an .apk and Emailed to my Android device.

    I dunno if this will help but here's how I'm loading the local storage.

    The save game saves entirely too much information for my usage. Plus, I need to use local storage to save text files. Above is how it initializes the startup variables. It tries to load them from local storage as a .json. If I read correctly, when that fails, all of the vars will come back as being 0. I then look to see if they are 0 and set them to some default values.

    The save is a 1 event function that saves the dictionary to local storage as a .json.

    I know it's working in other formats because it's not loading the default values. For example, I can change the editor font value to 45 and when I restart, it's set to 45 instead of 20.

    I've tried relocating that section of code I posted to another layout that's called after everything else loads. I've added a local storage onError event. Nothing. Doesn't give any error. I've even exported to NW.js just to see if that worked and it does. Somewhere between building with XDK and getting that app onto my Android device, Local Storage simply doesn't work.

    I'm running Lollipop 5.0 on my device and I've tried exporting from C2 as a 5.0 specific export. Still fails.

    This still has me totally befuddled.

    Is this normal???

    XDK keeps ripping these plugins out which I assume are set by C2's export.

    Is this normal???

    Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: cc.fovea.plugins.inapppurchase[/code:oe2ksied]
    
    [code:oe2ksied]Build Date: 2015-12-04 01:42:49 +0000
    --------------------------------------------------------------------------------
    PLUGIN OUTPUT
    --------------------------------------------------------------------------------
    Installing "org.crosswalk.engine" for android
    "plugman install --platform android --project /project --plugin cc.fovea.plugins.inapppurchase": Fetching plugin "cc.fovea.plugins.inapppurchase" via npm
    Failed to fetch plugin cc.fovea.plugins.inapppurchase via registry.
    Probably this is either a connection problem, or plugin spec is incorrect.
    Check your connection and plugin name/version/URL.
    Error: Registry returned 404 for GET on https://registry.npmjs.org/cc.fovea.plugins.inapppurchase[/code:oe2ksied]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads

    Is this normal???

    I'm getting pretty disillusioned about having purchased C2 right about now. I've been sitting on a completed C2 project for almost a week now. But it seems the only damned thing I can get it to work with is HTML5 and NW.js. And, the HTML5 only works if I don't want to have in-app purchases.

    Here's part of the nasty-gram Amazon shot back to me.

    We've determined that your app uses an older version of the IAP SDK. This may result in inconsistent behavior of IAP on the customer's device. We would suggest that you update your code to IAP v2.0. You may download the latest SDK from https://developer.amazon.com/public/resources/development-tools/sdk.[/code:2glkuadk]
    
    And since it seems damned near impossible to test an Amazon app before it's published, I have no clue if it's gonna work there or not.
    
    Now that I have the project finished it seems the only options I have to getting it into an .apk is this buggy piece of XDK crap that's half finished. An Adobe product that won't even get past the first bad plugin plus, wants a monthly fee for anything more than one app, or Cocoon which I'm refusing to even try on the principle that they hijack your app with a $500.00 splash screen.
    
    300 hours into C2 and I'm this close -><- to giving up and calling it a total waste of my time and money.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)