i'm using Cordova Chrome App with Android ADT Bundle.
I have made a test application that runs ok in web browser and as web app for chrome.
But when i run the app for android window.close() doesn't work when i create the "native" app for android.
I read about other methods in cordova and chrome.app... but it is difficult for me because i can not debug using console.log in android emulator.
My questions:
How can i close the app?
How can i debug through console.log for example?
I read and try log cat, etc. but it doesn't show anything from javascript
Thank you
You could use the below line of code to exit the app.
navigator.app.exitApp();
Related
I am developing an app with Cordova + Webassembly.
The customer needs the app to work on Windows and Android.
I am using Visual Studio 2017 + TACO.
The webassembly is generated from C/C++ code using emscripten and is working all fine on Edge and Chrome. It is also working on an Android device (Chrome)
The Cordova app running on Windows is working perfectly.
Now my problem is on Android. The Cordova app on Android log this error:
Fetch API cannot load file:///android_asset/www/script/myApp.wasm. URL scheme "file" is not supported.
I can't find anywhere if Cordova supports WebAssembly on Android. My understanding is Android is using a WebView component and should rely on Google Chrome (my Webassembly is working fine on Chrome on Android).
Is there an option somewhere to add a mime-type for cordova on android?
Thanks in advance for any help.
There is another option using the XMLHttpRequest object like showed at https://studiolacosanostra.github.io/2020/02/23/How-to-run-rust-wasm-on-cordova/.
Of course, you don't need to overwriting the fetch function like they do there, but you certainly can use the idea to create your own function.
As you can see in the console, "URL scheme must be “http” or “https” for CORS request.".
I am coding a Cordova application in Visual Studio. It is a hosted web app which means Cordova starts a webview with the local index.html and after deviceready, I redirect the document location to my locally hosted web url.
When I was testing on iPhone (iOS 9.3), I noticed that the Cordova app hangs/freezes at the splash screen after I rebuild the hosted web page. I thought it might be due to the latency occurring after compilation because it works in the successive trials. And I tried to debug using Visual Studio, attaching to the local device, and using the console I changed the url to test several sites. When response is immediate, no problem but when there is even about a second of latency, it does not navigate, but there seems no error in the Javascript Console of the Visual Studio debugger.
I know that there is a "loadUrlTimeout" parameter in the config.xml for Android but there is none for iOS. (I did not try it with Android if there is such a problem there too.) Am I doing something wrong? Is this the expected behavior? How can I fix it?
I am a developer of DisciplineXgames! We are developing a mobile app. We have downloaded the Cordova test suite from here (https://github.com/apache/cordova-mobile-spec). When I upload this on DisciplineXgames server it shows an error in alert box "Error: Apache Cordova did not initialize. Demo will not run correctly." but when we upload the same folder on Phonegap server it works perfectly fine. Unfortunately this doesn't solve our problem as we are building our mobile app on our server and just using Phonegap to redirect the user to the page hosted on DisciplineXgames server if there's Internet in the user's mobile.
First error which I got in the console area in Google Chrome is cordova.js missing when I provided that than it outputs another error that is cordova/channel is required.
Hope you can guide us through how we can use Cordova's amazing features on our server instead of Phonegap's local server.
I am a bit confused as to what you are trying to accomplish here but I am going to take a stab.
You want to develop an app that when the app launches, it checks to see if the device has internet connectivity. If it does, then the app just opens the mobile website hosted on your servers. if there is no internet connectivity then the app ???
Since this is a very simple use case for an app, I would avoid using cordova and instead use PhoneGap Build. Simply write an index.html page and a .js file to check for the connectivity and then use the inappbrowser plugin to open your mobile site if there is connectivity. Once that is done, zip your package, upload to phonegap build and then download your compiled apps.
phoneGap Build allows you to avoid the app building overhead and the need to install things BUT prevents you from taking advantage of some of the deeper configurations and some plugins. But again, for your simple use case, PhoneGap Build sounds like the way to go.
My question here is twofold:
1) Does Droidgap (or Phonegap for Android) support localstorage in the browser. Does phonegap simply make use of android's native browser (and if so, does this mean it supports html 5 local storage?)
2) Is there a way to debug an html5 webapp running on the phonegap platform in Eclipse? I'm running my application and it fails everytime I send a request to my server, however I see no error in logcat...
Thanks a lot!
Yes Phonegap supports localstorage, as you can check here
http://docs.phonegap.com/en/2.0.0/cordova_storage_storage.md.html#localStorage
Your javascript output should all appear in logcat.
PhoneGap does indeed support localstorage.
I was able to receive logs from my app by inserting log statements in the HTML/Javascript itself and look at the config files server-side. Thanks
I'm building a Phonegap application. I've already made the html application, and tested it in my Windows Google Chrome browser, with no errors. I've cheked it in the navigator of my Android Phone and it is working. However, after Phonegap, I see some things are not working.
Which browser is Phonegap using? Is it not the same as the Android navigator? Can I somehow debug it?
On my Eclipse console I only see errors about Vertext shaders.
Thanks
PhoneGap instantiates an Android WebView component with is not equal to the Android Browser. If your code has console.log statements you should be able to see them in LogCat tab in Eclipse.
If you want better debugging you should add WeInRe to your project for remote debugging.
You can add console.log statements, which can be seen with adb logcat in the Terminal, or with DDMS.
And how about this? What do you think?
https://chrome.google.com/webstore/detail/ripple-emulator-beta/geelfhphabnejjhdalkjhgipohgpdnoc?hl=en