I'm trying to make a Phonegap app for android and I have a problem that I can't figure out...
I used this tutorial for my first plugin http://devgirl.org/2013/07/17/tutorial-how-to-write-a-phonegap-plugin-for-android/ (I didn't copy past the code) and I created a plugin that works.
The problem came up when I moved the "web application" from the android device to my computer, ran in on apache and loaded the url on the device... The page comes up just fine and I get the "Device ready" message, but my plugin does not work...
Do I have to do anything differently if I want to run an external url?
Related
I just started Learnig Ionic and after a successful deploy of myapp (generate apk and install in my phone), i still get a web page error on my android device 'Could not connect to server (http://localhost:8080/)'
I believe the app should be offline because i haven't used any web service. check out the error here
The url http://localhost:8080/ would only work on the emulator but not on an actual android device.
Find the method webview.loadUrl() most likely on the MainActivity.java and change to something like webview.loadurl("file:///android_asset/www/index.html") instead of webview.loadurl("http://localhost:8080/");
Your app is offline.
A plugin that all Ionic apps have been using for ages, cordova-plugin-ionic-webview, released a new version 2.x on July 23rd 2018. This added a webserver into the Android app that is used to deliver your app files to the webview displaying your app. It runs on localhost:8080.
Unfortunately version 2 of cordova-plugin-ionic-webview does not support Android 4.x any more which you seem to be using. This is the eason why you are getting that error message.
You can probably fix your problem by downgrading to the last version of the plugin that supported Android 4.x:
ionic cordova plugin add cordova-plugin-ionic-webview#1.2.1
More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4
I have a Cordova App (5.0.0) developed in VS2015 (RC). The application successfully makes calls to a remote web service when running under the Ripple Emulator. As soon as the application is deployed for debug to a device (In this case a Nexus 6) the call to the Web Service returns a 404 not found error. When I check the IIS logs at the other end on the server I notice that no call was made by the device to the Web Service. I also checked the URL to ensure it wasn't being changed when deployed to the Device rather than Ripple. No such luck.
This started me thinking that perhaps there are special permissions or other settings I need to make to enable the application to run in Debug on the device. Does anybody have any clues what might be up? I have trawled the net for hours trying to find something similar.
Found the answer at last. For anybody else who is tussling with VS2015 or more to the point Cordova 5.0.0
From the release notes / known issues in VS2015 (RC) here:
The Android platform contained within Cordova 5.0.0 does not have a
"whitelist" plugin installed by default and therefore blocks network
access by default. There are now two whitelist plugins that can be
installed.
•Installing “cordova-plugin-legacy-whitelist” will cause the platform
to behave the way it did in 4.x and enables the "Domain Access" list
in the configuration designer. You can install it from the command
line or using cordova-plugin-legacy-whitelist.git from the
Custom tab of the configuration designer.
•Installing “cordova-plugin-whitelist” results in some new behaviors
and introduces new config.xml elements that can be added manually by
right clicking on config.xml and selecting "View Code." You can
install it from the command line or using cordova-plugin-whitelist.git from
the Custom tab of the configuration designer.
This mobile platform dev is all very flaky and underwhelming as an experience I have to say after coming from a predominately .NET development background.
I just recently installed apache cordova and am trying to get it up and running properly. I'm using a macbook pro running 10.9.5. My android SDK is the latest (22, but android target build uses 21). The cordova version is the latest as well (4.3). This issue occurs with any example app that I've tried, including the basic app/page that gets installed when you create a new cordova project (i.e. cordova create...).
For the most part, everything seems to be working ok, with one exception. When I try to view the android version of the test app in a browser (any browser - tried chrome, firefox, safari), I get various prompts that show up on the init/load of the app. The first prompt window to popup up says "gap_init:2", which is generated from the androidExec function in the cordova.js file:
androidExec.init = function() {
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire();
};
If I cancel thru these prompts (there are 3 prompt windows), then the app seems to load ok. If I 'ok' thru these prompts, then the app gets into an infinite cycle of processing empty messages, and I have to kill the browser processes to stop it.
The iOS version of the app loads fine in every browser. I've tried changing the android target to version 19, but the prompts still occur. There are no error messages during the build process.
Does anyone have any insight into what might be causing this? How is this prompt message supposed to be caught/handled?
Its simple, from visual studio, on running, it opens web pages for Android /iOS environment, you would have tried to cut-short the url to open for web version, this is when you will get dialog's as you mentioned.
To overcome this problem map the www folder to your local iis / iis express and open the url, page will open without any error.
This error you get when you use the following command directly as follows:
ionic serve
and then followed by
ionic cordova build android --prod --release
I SUGGEST TO FOLLOW THIS METHOD, IF YOU WANT TO RUN THE APP IN BROWSER
ionic serve
ionic build
ionic build --prod
This way you get www folder where you can upload to server and check the whole app in browser directly
I started with PhoneGap in Eclipse and made a basic app with some basic paragraph text...and it works fine in my emulator and real device (android os) ...but now I tried with some sample projects for the the PhoneGap 2.x Mobile Application Dev. Hotspot - from here
https://github.com/photokandyStudios/PhoneGap-HotShot-Book-Code-Bundle
and when I run the projects in my emulator or real devices it comes to 'Connecting to device' splashscreen and it never ends.
The same thing happened with the demo example coming in phonegap - only the splashscreen says "Device is ready".
I just want to note that I resolved the issue. Namely it was related to the github repo folder organization...just copy/paste the chapterXX/www folder to chapterXX/android/assets folder...it works then fine
I am building a Sencha Touch application that I then build using PhoneGap. When I installel the application on my android device for testing I got a strange prompt box asking me to provide a gap_bridge_mode?! What is this and how do I get rid of it (the prompt).
In my current situation I just click the Ok button without providing any value and all works fine. However I cannot release the application with this thing "welcoming" the user.
Please, help!
I think I found what the problem was. In my phonegap config file I indicated the use of phonegap 2.0.0 - the latest available version on the build server - while in the index.html I was loading the 2.1.0 - the latest version available for download.
After I changed index.html to point to version 2.0.0 I don't get this message anymore.
Thanks for the help.