Cordova Url Loading Not Working - android

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?

Related

How can I run ionic-angular application that calls APIs as Android App on a device

I have built an ionic angular application that connects to an API end point. On the web browser it works well. I compiled it for Android platform and opened it on the Android studio. When I connect my phone to the PC and run the application, it opens the login page which by default loads when the application starts up. However, immediately upon starting up it is supposed to make an API call which loads the initialization data, it instead generates a message as shown in the image attached.
error from API call in ionic-angular app on android
I have tried to find out, but it seems that the API calls are being blocked as the initialization data is not retrieved from the remote server. I checked through and found some related problems but their solutions never worked for me. Some of the links I referred to are:
XMLHttpRequest failed on App
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/
https://stackoverflow.com/questions/54275697/ionic-4-app-not-working-in-android-device#:~:text=2%20Answers&text=Go%20to%20AVD%20manager%20in,android%20and%20it%20should%20work.&text=When%20I%20had%20this%20issue,use%20the%20'new'%20operator.
Could someone point me to some info that can help me fix this issue.
I am relatively new in Angular and Ionic programming and I don't have a experience in using raw JavaScript though I use TypeScript in Angular framework.
I was able to fix my issue with the help from the link
https://imstudio.medium.com/android-8-cleartext-http-traffic-not-permitted-73c1c9e3b803

Cordova - In-App Browser to show website as desktop view

I was creating a Cordova (android) application in which I am using the In-App Browser plugin. I want the website in it to show as desktop view. I tried changing the user-agent with the <preference> (How i can set User Agent in Cordova App) tag in the config.xml file which is actually changing but it doesn't seem to be affecting the website state. I tried Googling that but I found nothing that could solve my problem. If you solved my issue, it would be really great if you could upload an apk for proof: please don't reply if you haven't tested your solution.
EDIT:
The problem is that the user-agent works only the first time you open the app... You have to clear the cache and open the app again so it works.

mjpg link not rendering on mobile app when built using Meteor

I am currently trying to get a multi-image url to render in my app. It works when I am testing it out in the url, but when I deploy it on my android device it doesn't render at all. It shows that no image found icon.
I am able to successfully build it using Meteor and having Cordova build the mobile version for me.
Here is the url I am trying out for example.
<img src="http://193.85.239.147:86/mjpg/video.mjpg?COUNTER">
What I am particularly looking for is some sort of work around that could also render this similar to that of or some setting stuff I need to change.
I read that there is a version of Chrome that this bug is present, but the Cordova uses Chromium and I am unsure if the bug exist in that as well or not.
Edit:
Upon further test, when I build and use on android phone img won't render anything in which its src is a url/link. It renders properly when I use it in a web browser, but mobile it fails. This is an issue I have yet to figure out a work around.

Android app works fine on web and on device through PhoneGap Desktop, but is just white screen on build.phonegap.com

This is my first time using build.phonegap.com. I have built an app that is entirely self-contained and doesn't use any connection or camera etc. It uses jquery, jquery mobile, HTML and CSS. It is a simple quiz that simply navigates through the DOM to verify the user input.
Here's what I do:
I use PhoneGap Desktop (on Windows) to generate the project and then add the code afterwards. I test it on my browser, then I test it on my device (Android) through Phonegap Desktop and then I zip up the folder (the project folder that was originally generated by phonegap desktop) and upload it to build.phonegap.com.
When I run it through the browser it works perfectly, with no error in the console.
When I run it though my device via PhoneGap Desktop, again, it runs perfectly.
When I upload it to build.phonegap.com, all seems to be fine (no issues in the debugger either). I run it my Android device via the QR-code-download and it installs with no issues.
When I open the app via build.phonegap.com, I just get a blank white screen.
I have checked my config.xml file and all the images and references are correct. All js and css files are referenced correctly (I've checked and it all works on my device via PhoneGap desktop and on my browser).
There are no js errors in the Chrome console.
I have feeling that I'm missing out something important. I haven't developed an app for a while a lot of the advice and tutorials seem to be out-of-phase with my project.
Can anyone help?
Many thanks,
Joe

Cordova features aren't work on server

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.

Categories

Resources