cesium in an offline android app

Hi,

I want to use cesium in an offline android app that shows travel routes for users in areas with poor connectivity or with no internet access.

For that, I plan to implement custom local imagery and terrain server and to wrap cesium with java.
I do this because I have good experience with Cesium, and because it will simplify the development workflow of desktop and mobile versions.
Since I have no experience with such kind of work (cesium in android, offline, etc.), I want to ask if someone have experience or have any insights/caveats which could help me in this mission.

Any help would be welcome.

Thanks a lot, and keep up the good work.

Hi,
I have been doing it for the past few weeks and I can assure you that it is not very difficult to do.

Part one of the solution is to getting Cesium running on your laptop, which you say you are comfortable with. Host your application on the webserver and note the url at which it is hosted (don’t worry about the IP part as yet).

Part two is connecting both, your laptop as well as your android device to the same wifi hotspot (not necessary for it to be connected to the internet). I do it using a USB modem that needs a SIM to connect to the internet. I don’t use it to connect it to the internet though. When both my devices are connected to the hotspot, I run ipconfig (sudo ifconfig if using linux) on the laptop and note the local IP that is assigned to the machine (it will be 192.168.XXX.YYY).

Last step is to fire up the browser on the Android phone and point it to the application on the Laptop viz http://192.168.XXX.YYY/Cesium/MyApplication.html

Done.

Cheers!

Hi Gaurav,
Many thanks for this guide... It's a good starting point.

Do you have any experience with offline on android?

There are many programs for offline map caching for android, and I deliberating what is the best approach:
1. to use one of those cache formats for tile caching, then read tiles with the wrapping app and feed cesium with this tiles (with modified requstTile functions)
2. Simply run local web server and point cesium to fetch its tiles from it. With this approach I will also have to implement tile caching, but there is no need to change cesium.

Sorry, I do not have any experiencing of making Cesium run as an Android aapk application. Is it even possible?

I am also unaware about tile caching in Cesium and am looking for an option that enables it. Because right now, the application that I am running on the Chrome browser on my mobile shows a fixed tour that needs fast loading of tiles. If there was a way to cache those tiles, it would be a much pleasant experience than it currently is.

I am sure some of you who are more experienced with Cesium can help.

If you want to use Cesium within an Android app, you may want to look at implementing a web view within your app, which basically just embeds a web browser in your apk app. I have not tried this, but I’m looking at using Apache Cordova with Cesium and will let you know if I have any luck.

I have not used a webview in Android, but I did use one in a packed chrome application and it worked just fine. If your application you build in the webview requires communication with the containing application you’re going to need to build into your application either a hash (#) based routing scheme so you can send data or implement a messaging service handler so you can pass data around that way. Webviews are sandboxed to prevent hacks from gaining access to the system so you will not be able to just access the DOM like you would an iFrame.