android cordova phonegap config.xml unbound prefix - android

I have the following config.xml file for my android app, and I am trying to install launchmyapp plugin. Everytime I clean, I get this the following error
/code/platforms/android/res/xml/config.xml:21: error: Error parsing XML: unbound prefix
I checked other stack questions and everyone is pointing to wrong formatting in the parameter fields, but all seems ok...
here is the config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myappname.Myappname" version="2.2.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyAppName</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<feature name="org.apache.cordova.facebook.Connect">
<param name="ios-package" value="FacebookConnectPlugin" />
</feature>
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<content src="index.html" />
<access origin="*" />
<gap:plugin name="nl.x-services.plugins.launchmyapp">
<param name="URL_SCHEME" value="myappname" />
</gap:plugin>
</widget>

I've encountered the same question as yours. I supposed it's because
<gap:plugin> must be bound to phonegap prefix.
So I solved this question by adding xmlns:gap="http://phonegap.com/ns/1.0" at node.
In your case, the full <widget> should be:
<widget id="com.myappname.Myappname" version="2.2.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
Hope it works for you.

Related

Window.location doesn't work on Phonegap/Cordova version 4 after upgrade

I have an application based on Cordova 2.7 for Android platform.
Yesterday I had to upgrade Cordova version because of Google Play warning about vulnerabilities...
What I did is to create a basic Cordova app throw terminal commands before upgrades.
After that I put this code into the index.js default file:
onDeviceReady: function() {
app.receivedEvent('deviceready');
//navigator.app.loadUrl('http://www.google.com/');
alert('inside');
//console.log(navigator.app);
//window.location = encodeURI('http://www.example.com');
//window.location.href = 'http://www.example.com/';
window.location = 'http://www.example.com/'; <--- Not works
//window.location = 'local_page.html'; <--- this works perfect
//window.open('http://www.google.com', '_self');
}
And the config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget
id="com.example.app" version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<name>TPV_APP</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
Window.location doesn't work. Indeed doesn't show any posible error.
Its just doesnt work.
If window.location redirect to local pages, it works perfectly,
but for external pages it doesnt.
The alert is executed ok.
INFO: In my previous version of Cordova was working without problems.
I need to be redirected within the same webview. Not open another webview or browser.
I have been searching solutions for 2 days.
Any idea will be appreciated.
Thanks.

ionic -firebase email& password login not working in android

It's work OK in web browser but when I try to login via email& password I get the error :
Unable to contact the Firebase server
this is how I login :
var auth = $firebaseAuth(firebaseMainRef);
auth.$authWithPassword({ email : email, password : password })
I use: Firebase v2.0.5
this is the confif.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myapp501948" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>myApp</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
</widget>
thanks!
Adding cordova plugin of whitelist solves the problem

PhoneGap Build - Build an Android application?

The problem I am encountering is that I want to unable the orientation on the application that is running on my tablet, I only want landscape view.
I have created the application using cordova, then added the platform "Android". Then I moved the config.xml into the www folder with HTML, CSS and JavaScript code and added the code line below inside config.xml.
Then I zip the www folder with config.xml, and used PhoneGap Build, to convert to an Android application.
When I test this on the tablet, the orientation does not work. How can I prevent orientation on the tablet by using config.xml?
I found the preference here.
<preference name="Orientation" value="landscape" />
Config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.BachelorProject.KPEC" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ProjectKPEC</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="Orientation" value="landscape" />
</widget>
Preference attribute values are case sensitive I think.
Try:
<preference name="orientation" value="landscape"/>
Instead of
<preference name="Orientation" value="landscape" />
I found out the problem, just built the whole project and added android platform again, then I moved config.xml inside www folder, and it worked.

$http call won't work on Ionic Android build

This is how I'm making the call:
$http.get( url, {
params : {
empId: $scope.empId
}
}).then(function(data, status){
$scope.workOrders = data.data;
}, function(data, status){
$scope.message = data;
});
It works just fine on Chrome, and if I navigate to the URL on my phones browser I can get a response just fine.
However, whenever I use the .apk that gets built I get:
{"data":"",
"status":404,
"config":{
"method":"GET",
"transformRequest":[null],
"transformResponse":[null],
"params":{"empId":"123"},
"url":"http://...",
"headers":{"Accept":"application/json, text/plain, */*"}
},"statusText":Not Found"}
Kinda lost on this one. Just weird that I can hit the URL from my phone browser but not within the Ionic/Cordova built .apk
As requested, here is my config.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myapp397384" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>myApp</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
</widget>
Aha!
Apparently Cordova just released cordova-android 4.0 not too long ago and it by default blocks http requests.
Just run this command:
ionic plugin add cordova-plugin-whitelist
And you're good to go.

CocoonJS & Cordova plugins: "class not found" error

I would be glad if we had an example on how cordova plugins should be wrapped for CocoonJS.
I'm trying to use the device-orientation plugin (compass) in a simple example but after the app has initialized, the navigator.compass.getCurrentHeading() returns an CompassError with the code:
Class not found
The class name cannot be resolved correctly, so probably something's wrong with the config.xml file.
After combining many sources, mine looks like this:
../www/config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="my.compass.html" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordovaCompass</name>
<description>
A sample Apache Cordova application that displays the current compass heading after the deviceready event.
</description>
<author email="a#cordova.apache.org" href="http://cordova.io">
</author>
<content src="index.html" />
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="orientation" value="landscape" />
<preference name="webviewbounce" value="true" />
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<feature name="Compass">
<param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener" />
</feature>
</widget>
I've also tried to include compass as plugin:
<plugin name="Compass" value="org.apache.cordova.device-orientation" />
with no difference..
PS: The app works fine on plain Cordova.
[UPDATE]
Maybe the problem is here:
For this example I zipped the <project-name>/platforms/android/assets/www folder.
I'm not sure if this is enough for a Cordova plugin app, as the native code of the plugin is not included (CompassListener.java) and the only part that seems to work is actually its JavaScript interface (compass.js, CompassError.js, etc)..
On the other hand, If I try to zip the whole <project-name> directory as pointed out at the bottom of this tutorial, the CocoonJS Launcher crashes..
So, could at least someone confirm that the launcher can actually compile Cordova plugins?
If you want to use plugins you have to zip all Cordova project folders. Example:
cd ~/projects/ && zip -r -X hellococoonfull.zip helloCocoonJS && cd -
See the section "Using Cordova Plugins" of Getting Started with Cordova and CocoonJS guide.
[Update]
The CocoonJS Launcher is not ready for plugins yet. For using plugins you have to use de cloud compilation system.

Categories

Resources