Hi Ed Mackey, as I have also tweeted you, Im currently trying to get Cesium to work on Android. I downloaded the Cesium repo from https://github.com/AnalyticalGraphicsInc/cesium
I plan to run Cesium on a WebGL-enabled browser,specificially Firefox, in an Android device.
My idea is to build Cesium on Android using the ant tool, which I found that there is an ant tool for android. http://code.google.com/p/autoandroid/source/browse/trunk/samples/notepad/build.xml
I initially tried to generated a build.xml from scratch in my Cesium Android code but I was unable to build it using “ant debug”.
The error I received is
C:\Android Project\GIS\GIS\build.xml:548: The following error occurred while executing this line:
C:\Android Project\GIS\GIS\build.xml:279: apply returned: 255
The problematic line of code is at
I googled to see if others had encountered this problem. I have set my PATH variables as from this solution below to no success.
I am wondering how are you guys able to run Cesium on Android? Did you guys use ant to configure build.xml for Cesium on Android? I deeply appreciate any help.
Hi, I didn’t realize that you’re actually trying to run Ant on the Android device itself to build Cesium. Typically what we do here is build Cesium on a desktop machine, and copy the resulting files to a web server that the Android device can reach.
Are you sure you need to run Ant on Android? Most of the build process is only needed after changes to the source code, so you could easily build on another machine if you aren’t editing the Cesium source directly on Android.
There is a mini webserver available in our build process. I don’t use it myself, but I can imagine that if you want Cesium to run stand-alone, on a disconnected Android device, you would need a small webserver to host the prebuilt Cesium files internally, and set FireFox for Android to point at localhost. You wouldn’t need Ant specifically, but you’d need some small server to run in the background on Android if the device was otherwise offline, and couldn’t access any network or web servers at all. Is that what you’re trying to do?
Yes, I have viewed Cesium’s code and I believe I know about the mini webserver that you guys are using in Cesium’s build. This webserver is called jetty, if I am not wrong? I have did some research on jetty and found out that there is an Android version of jetty.
I would like to ask you what is the proper procedure to use jetty for Cesium on Android? I installed the apk for jetty into my Android emulator, then I ran Cesium Android app on my Android emulator. However, when I point my Android browser to localhost at
http://127.0.0.1:8080, the browser displayed that there are no web apps deployed to jetty.
Sorry but do you have any idea what I am doing wrong? I intend Cesium to run standalone on a disconnected Android device. I deeply appreciate any advice.
I don’t use or know much about Jetty or i-Jetty, but it looks like it might be overkill for what you’re trying to do. Of course you can check the iJetty documentation here:
I did a quick search and found another server here:
Maybe you could give that one a try? It looks more geared to serving simple files as opposed to iJetty’s downloadable-webapp configuration thing.
One more comment, if you’re running Cesium on a disconnected Android device, you won’t have access to streaming imagery like Bing, so you’ll probably have to make do with the non-streaming single-image Earth texturemap. (That’s the other reason Cesium includes Jetty, is to provide a local proxy for browsers like Safari that don’t handle CORS well enough for our purposes. We have the offending browsers request imagery tiles from Jetty which forwards the request on to the tile provider. But in an offline environment you won’t need to worry about any of those issues).
Hi Ed, thanks for the link to the android webserver. However, do you have any idea whether it is possible for my own webserver to serve the files needed to run Cesium on Android device. The Android device does not have internet access.
Sorry I made a mistake earlier. My Android device does not have internet access so I cannot use either jetty or android webserver.
Can I use my own webserver to run Cesium on Android? I greatly appreciate your advice.
Hi, I believe the answer is yes, Cesium should be able to run from a custom webserver on Android. The server doesn’t need to perform any computations, just serve the files after you copy them to the Android device. But Cesium is relatively new, and none of us have tried to get it working offline. Even the online version isn’t very mobile-friendly yet.
Your next step should probably be to get a test webpage being served from your Android’s SD card or internal memory, and see if you can get that to appear in a browser while the device is offline. I’ve never done that, so you might want to get help from the authors of web server apps for Android to see if one of them will work for you. You don’t need to use Cesium for that, just get any old “index.html” page working without resorting to “file:///” links in the browser. Once that’s working, you replace index.html with a pre-built copy of Cesium.
Also, WebGL support on Android is still up and coming. It is supported in Opera and Firefox, but Firefox did not have great performance last time we checked (it’s been a while though), and I personally haven’t tried Opera, but I suspect Cesium will need some tweaks to run on it. There is a bit more info in the FAQ.
Given that we haven’t tested on Firefox Mobile recently, I expect that a few Cesium shaders will need minor tweaks to run, and touch events will have to be hooked up.
Are you saying that it is not possible to stream imagery in an offline environment? what if we store imagery in local storage or something and serve them to a local server? will that work?
Loading imagery from local storage should work fine. You’ll need to implement an ImageryProvider that can retrieve each tile on-demand, as it is needed. One problem to deal with will be the very small size limit that most browsers have for the local storage API (5 MB in most browsers). For a low-res set of imagery, that may not be a problem, though.