Trying a simple cordova app and have the controls and bars up w/ a star background but no earth. This is really realy basic - any advice as to what I may be missing in terms of network access or ports, permissions, etc.?
I was surprised how easy it was to get the app up. Single line creates the cesiumViewer in the default hello world so it seem to be close.
Are there any error messages that come up? I’m not very familiar with developing on that platform, but the fact that there’s no earth at all is strange. Usually if you were having network problems or something, the globe would still show up, but it’d be blue instead of having imagery.
No terrrain. i’ve been doing cesium for 6 months on standard JS and PHP and it works great. The viewer is created with no options at all.
I did find last night that if I change the base layer once it’s up on android I get the blue untiled earth which made me happier. It appears it has to do with fetching tiles and net connectivity.
I also find that if I build cordova for the browser I get the earth. If i build it for the emulator I don’t get the widget at all and get cesium widget level errors. If I build it and deploy on a real android device I get the widget minus earth - and things like the geocoding location give an error which seem to be net errors. If I swtich base layer with the widget control I get a blue earth. Looking at the adb console it looks like there are zero webgl errors so that’s good too.
I’m still looking into the net access issues. The android app white lists all ports and domains while we’re testing. Its not clear from the forum if anyone has tried cesium under cordova and what kinds of quirks they might have found. I will say the widget looks better as an app than in the browser on the device.
I had a working cordova app with cesium, but I can’t remember off the top off my head specifically, the configurations and settings I had to apply to make it work. I think I had to add a whitelist as per the above link.
I have found that the issue is definitely related to inability to access the imagery. Here’s the error - I have a valid bingmaps key which I didn’t include here - and the entire URL in the debug message works from the browser.
I did notice there’s a ‘.’ at the end of the debug message url - that of course is NOT a valid url request and does generate an invalid credential response from bing. So if that’s appended to the url that’s not good.
Notice the “//” in that virtualearth URL? Because your cordova app is being served from “file:///” and not an actual web server, this is what the request is trying to load from (ie. It’s trying to load file:///dev.virtualearth.net/… )
To fix this, you have to add the explicit (http/https) protocols in the cesium code where these URLs come from (I think it’s the base layer picker widget).
I like digging a lot and you had the magic dust. I owe you.
I hope to get this running on all three classes of tablets and phones over the weekend and then try my big app which should be fine given this worked well.
I readed your post, and i would like if you could give some example of your test Cesium+Cordova, I made two test with Cordova and Cesium, the first one i write the code and put in the visor, it is working on web browser in the pc, but when build the apk it doesnt work o my android device, this show me "Error constructing CesiumWidget. runtimeError: The browser supports WebGL, but initialization failed. Error at new t (files:///andorid_asset/www/Cesium/Cesium.js:424:15632) ...", this same error happens when try this project https://github.com/TomPed/Cesium-Mobile.
Could you help me to find out what is missing in my project,or give one of your project examples to test?.
Thankd for your help.
I had to make minor mods to the software. As I remember it there are hrefs to the earth imagery resources that are assembled when cesium is launched and these had to be changed to hard coded links. It wasn’t a big deal to find them. I used the console to find the error, searched for the root of the href, and made the change. I did this in the unminified version. It was pretty easy to do. One note was that each of the possible sources (WGS, ESRI, etc.) had to be changed. I’d find the one the causes the error (you’ll find the earth doesn’t populate and remains blue) - make the chance, re run cordova, install on the device, and make sure you got the fix right then change the others as needed.
THis error also looks like your trying to keep the code on the device. My code all resides on a regular remote server so that part i can’t help with because I haven’t run into it.