function init() {
Cesium.Ion.defaultAccessToken = 'eyJhbG******28r6gE';
var viewer = new Cesium.Viewer('cesiumContainer');
}
On the desktop web chrome it works pretty well, but when running as Cordova hybrid app in the simulator. Nothing shows up and when i open console it says cesium is just a empty object. and it has a error
TypeError: undefined is not an object (evaluating 'Cesium.Ion')
Global Code
evaluateWithScopeExtension
(anonymous function)
_wrapCall
I did recently get Cesium + Cordova working on my Android phone (as of a few weeks ago).
Can you post your full project setup, perhaps as a GitHub repo? You may be missing some configuration there, and that can help us create an updated official example.
It is very basic cordova project. Steps i used to create project
Step 1
cordova create hello com.example.hello HelloWorld
Step 2
cordova platform add ios
Step 3
// Updated www folder to implement very basic example of cesium
Step 4
cordova build ios
Step 5
cordova run ios
IMPORTANT: Hey @omar i am the same guy who reported below issue lol. In below issue i was using capacitor with ionic and it was failing if i add any cordova plugin. But after doing some research i found that it has nothing to do with capacitor or ionic. Either it is Cesium or it is Cordova. For that reason this time i tried with simple basic HTML, JS with cordova and there also it fails . I think some configuration is missing in the documentation.
Hi Omar, thanks for checking. It’s not android that is failing, it’s IOS where it fails.
For android device my application also works.
But when you try to build iOS then it errors. For generating iOS build you will have to first add iOS platform and then do a build. Which will generate IPA file instead of APK file.
You can see commands I use are for iOS
Step 1
cordova create hello com.example.hello HelloWorld
Step 2
cordova platform add ios
Step 3
// Updated www folder to implement very basic example of cesium
Step 4
cordova build ios
Step 5
cordova run ios
I don’t have an iOS device setup to test with this right now, but it looks like the issue here is coming from the FullScreen button, which is generally not supported on iOS. You can read a bit about that here: https://github.com/CesiumGS/cesium/issues/8746.
Can you try disabling the fullscreen button by passing fullscreen: false to the Viewer constructor?
@omar Kindly share the google drive link to me also.
I am trying to build app for android and ios using monaca which uses cordova to make a remote build. cesiums map doesn’t appear in android and ios device. screen stays black.
@sam.rothstein I uploaded your project in monaca (same as cordova), and it worked perfectly in mobile app. But still, Im unable to show cesiumjs earth on my actual app. I have developed using Angular. I am trying to upload angular build to monaca, but maps arent showing up.
Hi @sam.rothstein, any assistance you can provide to get the app that @naveedshahzad_o is working on up and running would be greatly appreciated. Many thanks in advance
I am glad to hear that my project worked well for you in the mobile app! This seems like a great first step
What exact error are you receiving when the Cesium Viewer is failing to load? Some more information on where you are adding the CesiumJS code would also be helpful. To be candid, my experience with Cordova/Monaca is limited - community suggestions would be especially welcomed here!
Thank you for the details on your code and the clarification about the error. From my end, nothing looks blatantly incorrect. However, as mentioned before, my experience with Cordova is limited.
@Shashwat_Tripathi@Jackie@Chris_Wang your input on Cordova-related issues in the past has been both timely and accurate. The community really appreciates your engagement. Do any of you have suggestions for @naveedshahzad_o?