How can i install Shield TV support in Phonegap build?
when i add this to my config.xml
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
i get this error message
Error - Malformed config.xml - You can fix this here
Any ideas what i making wrong?
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.xxxx.app"
versionCode = "1.0.9"
version = "1.0.9" >
<!-- versionCode is Android only -->
<!-- version is in major.minor.patch format -->
<name>XXX</name>
<description>
XXX
</description>
<author href="xxxxx" email="contact#xxx.com">
XXX
</author>
<icon src="icon.png" />
<preference name="fullscreen" value="true" />
<preference name="StatusBarOverlaysWebView" value="true" />
<access origin="*" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<!-- Intenet zugriff plugin -->
<plugin name="cordova-plugin-whitelist" source="npm"/>
<plugin name="cordova-plugin-statusbar" source="npm"/>
<!--- <plugin name="cordova-plugin-fullscreen" source="npm" /> -->
<plugin name="cordova-plugin-vibration" source="npm" />
<plugin name="cordova-plugin-x-socialsharing" source="npm" />
<plugin name="phonegap-admob" source="npm"/>
</widget>
Well, try to check this documentation on how to properly build the PhoneGap.
You can check here the Essential Properties and Example of config.xml
I also found here in this Failed Builds that if you encountered an error Malformed config.xml, you can use the W3C validator to check whether your config.xml is a valid XML.
Related
I am able to successfully build and run my app in ios5, but when I upgrade to ios6.1.0 in order to install a plugin that will allow me to use VKwebview and reference local html files, I get 3 fatal errors in xcode:
Property 'userAgent' not found on object of type 'CDVViewController *'
Use of undeclared identifier 'CDVUserAgentUtil'. (these are repeated twice)
I am at a total loss as to even start looking for the answers.
This is my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.slate.v2" version="1.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>ACCELERATE RMS</name>
<description>
M-learning accelerated.
</description>
<author email="support#phonegap.com" href="http://phonegap.com">
Cnnect
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<icon density="mdpi" height="57" platform="ios" src="icon.png" width="57" />
<config-file overwrite="true" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>Allow the app to use your camera to take your profile picture.</string>
</config-file>
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<platform name="ios">
<preference name="Orientation" value="all" />
</platform>
<engine name="browser" spec="^5.0.4" />
<plugin name="phonegap-plugin-contentsync" spec="~1.4.2" />
<plugin name="cordova-plugin-camera" spec="~4.0.3" />
<plugin name="cordova-plugin-geolocation" spec="~4.0.1" />
<plugin name="cordova-plugin-file" spec="~6.0.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
<plugin name="cordova-plugin-dialogs" spec="~2.0.1" />
<plugin name="cordova-plugin-local-notification" spec="~0.9.0-beta.3">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="26.+" />
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="~8.0.1" />
<plugin name="onesignal-cordova-plugin" spec="~2.8.1" />
<plugin name="cordova-plugin-file-transfer" spec="~1.7.1" />
<plugin name="cordova-plugin-wkwebview-engine" spec="^1.2.1" />
<plugin name="cordova-plugin-wkwebviewxhrfix" spec="~0.1.0" />
</widget>
CDVUserAgentUtil has been removed in cordova-ios#6 which is a breaking change (hence the major version increment in cordova-ios to 6).
This class is used by some Cordova plugins in your project hence the error.
You should first update all of your plugins to the latest versions so those which have been updated to removed references to CDVUserAgentUtil are used.
At least one of your plugins - cordova-plugin-file-transfer is deprecated and contains an implicit reference to CDVUserAgentUtil. In this case you could use my fork of this plugin which has been fixed to remove the reference:
cordova plugin rm cordova-plugin-file-transfer && cordova plugin add https://github.com/dpa99c/cordova-plugin-file-transfer
It may be that other plugins in your project still contain references to CDVUserAgentUtil after updating all your plugins.
If this is the case, you should search them for references:
grep -r -l 'CDVUserAgentUtil' plugins/
If you find any references and no plugin upates are available, you could:
raise an issue against the plugin asking for it to be updated
look for a fork of the plugin that has already been updated
fork the plugin and fix it yourself
If the build still fails after updating all your plugins to remove the references, there may be more implicit references such as that in cordova-plugin-file-transfer so you'll need to search for and resolve those:
grep -r -l 'userAgent' plugins/
The cordova-plugin-wkwebview-engine is deprecated in Cordova iOS#6.x for more details see, from Cordova iOS#6.x onwards it by defaults supports WKWebView not UIWebView. So, you need to remove the Cordova plugin from your project.
cordova plugin rm cordova-plugin-wkwebview-engine
Note : Please backup your project before doing any change for your safety.
For ionic v5 users
I have fixed this by upgrading cordova-plugin-ionic-webview to 4.2.1
hopping this help
I have an app that uses the user's location to find landmarks they are near. After submitting my Phonegap app to the iOS store, it is getting rejected for the following reason:
"We noticed that your app requests the user’s consent to access their location but does not clarify the use of the location in the applicable purpose string. Please revise the relevant purpose string in your app’s Info.plist file to specify why the app is requesting access to the user's location. You can modify your app's Info.plist file using the property list editor in Xcode."
I thought I had addressed this issue by adding the following to my config.xml file:
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>The user's location is used to find the distance they are from certain landmarks.</string>
</edit-config>
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.myapp" version="1.0.10" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>MyApp</name>
<preference name="android-targetSdkVersion" value="26"/>
<description>
A blank PhoneGap app.
</description>
<plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />
<plugin name="cordova-plugin-geolocation" spec="2.4.3" />
<plugin name="cordova-plugin-x-socialsharing" spec="5.4.0" />
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>The user's location is used to find the distance they are from landmarks.</string>
</edit-config>
<icon src="images/icon.png" />
<icon height="40" platform="ios" src="images/icon40.png" width="40" />
<icon height="76" platform="ios" src="images/icon76.png" width="76" />
<icon height="120" platform="ios" src="images/icon120.png" width="120" />
<icon height="152" platform="ios" src="images/icon152.png" width="152" />
<icon height="1024" platform="ios" src="images/icon1024.png" width="1024" />
<author email="support#phonegap.com" href="http://phonegap.com">
PhoneGap Team
</author>
<content src="index.html" />
<access origin="*" />
</widget>
However, it is still getting rejected for this reason. How could I modify the config.xml or anything else to not get rejected for this reason on the iOS store?
I removed this part:
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>The user's location is used to find the distance they are from certain landmarks.</string>
</edit-config>
and added this part:
<plugin name="cordova-custom-config" version="*"/>
<config-file overwrite="true" parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist"> <string>Your location is used to find how far you are from landmarks.</string> </config-file>
<config-file overwrite="true" parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist"> <string>Your location is used to find how far you are from landmarks.</string> </config-file>
Now it's working as expected.
I have a Windows 10 UWP application built using Ionic/Cordova, so my http requests originate from the embedded webview.
I can run my application at home, or on a tablet connected via cell and the http requests all work. However, when I run this on any office machine (work machines), the requests other than to local host appear to be blocked. I initially thought this was the network, however using Wireshark, I can see the request if I just run them in the machine browser, but I can't see them if I run the same from the application.
If I run the application via the desktop browser (using Ionic serve), it also works. It only seems to be when it is running in the UWP container.
Since the requests don't appear in Wireshark, I have no idea how to diagnose where this is getting blocked.
How can I diagnose this (I assume the local TCP/IP stack?)
Update 1
Some more information on a minimal application
I create a new Ionic 3 application, straight from a template, and my config.xml looks something like
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" 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 awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="*" />
<feature name="http://api.phonegap.com/1.0/network" />
<access origin="*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="windows-target-version" value="10.0" />
<platform name="android">
...
<platform name="ios">
...
</platform>
<engine name="windows" spec="^5.0.0" />
<plugin name="cordova-plugin-console" spec="^1.0.5" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-wkwebview-engine" spec="^1.1.3" />
</widget>
When I build to the Window package, the AppxManifest.xml includes the following...
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
The test service should by CORS enabled, and I can connect to it via cell, and any other network I have tried except for our office network, as we have no idea where it is being blocked. I don't see anything in wireshark. If I run the same application via Ionic serve (so running in the desktop browser), then I have no problems. If I install the Windows version at home, I can connect. If I install it on a Tablet (eg Surface), then is does NOT connect if the serface is on the office WIFI, but it DOES connect if I tether the surface to my phone.
If we give the Surface a fixed IP it also then seems to work. I have no idea why the fixed IP makes a difference.
The actual test app code looks like the following (the only difference is the url to the office test server)...
export class HomePage {
public result : any;
public url : string;
constructor(public navCtrl: NavController, private http: Http) {
this.url='http://mytesturl';
}
public onClick() : void {
this.http.get(this.url).subscribe(res => {
this.result = res.statusText;
console.log(res);
}, (error : Response) => {
let json = error.json();
this.result = `failed ${error.statusText}`;
console.log(error);
});
}
}
We had the same problem and fixed it by adding the capability "privateNetworkClientServer" to the app. Perhaps that's your problem as well?
I'm trying to update an app to a newer version and I am unable to get my login scripts to work anymore in v 5.1.1 of Cordova.
I have the whitelist plugin installed according to cordova and inappbrowser allows me access to the internet.
I shortened the config.xml to allow all connections. I think
Config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.company.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>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" />
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
Cordova Plugin list.
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.2.1 "File Transfer"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-media-capture 1.0.1 "Capture"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-whitelist 1.0.0 "Whitelist"
So I moved
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
to the top of my plist file and it started working. I previously had it at the bottom. Not totally sure why it worked but it did.
I have recently started some app development with Telerik's AppBuilder and am running into one thing that I'm not certain of. I added a custom plugin to my project (Cordova Local Notifications Plugin) which seemed to work (it shows up in my solution now under a Plugins folder), but I have no idea how to reference the scripts and such from it. According to the Telerik documentation (Reference the Custom Plugin in index.html and config.xml), they say to add includes for anything with in the plugin.xml file, yet this plugin doesn't have that.
Any ideas on how I reference their script so I can start using it? Do I just reference Plugins/cordova-plugin-local-notifications-master/www/local-notification.js file direct or something else? Here is their plugin.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="de.appplant.cordova.plugin.local-notification"
version="0.8.0dev">
<name>LocalNotification</name>
<description>The purpose of the plugin is to create an platform independent javascript interface for Cordova based mobile applications to access the specific Notification API on each platform.</description>
<repo>https://github.com/katzer/cordova-plugin-local-notifications.git</repo>
<keywords>notification, local notification, alarm, scheduler, tile, live tiles, ios, android, windows phone 8, wp8</keywords>
<license>Apache 2.0</license>
<author>Sebastián Katzer</author>
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<dependency id="org.apache.cordova.device" url="https://github.com/apache/cordova-plugin-device" />
<js-module src="www/local-notification.js" name="LocalNotification">
<clobbers target="plugin.notification.local" />
</js-module>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="LocalNotification">
<param name="ios-package" value="APPLocalNotification" onload="true" />
<param name="onload" value="true" />
</feature>
</config-file>
<header-file src="src/ios/APPLocalNotification.h" />
<source-file src="src/ios/APPLocalNotification.m" />
</platform>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="LocalNotification">
<param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<!--
* The alarm receiver is triggered when a scheduled alarm is fired. This class
* reads the information in the intent and displays this information in the
* Android notification bar. The notification uses the default notification
* sound and it vibrates the phone.
-->
<receiver android:name="de.appplant.cordova.plugin.localnotification.Receiver" />
<!--
* This class is triggered upon reboot of the device. It needs to re-register
* the alarms with the AlarmManager since these alarms are lost in case of
* reboot.
-->
<receiver android:name="de.appplant.cordova.plugin.localnotification.Restore" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<!--
* The receiver activity is triggered when a notification is clicked by a user.
* The activity calls the background callback and brings the launch inten
* up to foreground.
-->
<activity android:name="de.appplant.cordova.plugin.localnotification.ReceiverActivity" android:launchMode="singleInstance" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</config-file>
<lib-file src="libs/android/android-support-v4.jar" />
<source-file src="src/android/LocalNotification.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Receiver.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Options.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Restore.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/ReceiverActivity.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
</platform>
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="LocalNotification">
<param name="wp-package" value="LocalNotification"/>
</feature>
</config-file>
<source-file src="src/wp8/LocalNotification.cs" />
<source-file src="src/wp8/Options.cs" />
</platform>
</plugin>
Any JavaScript file references are automatically inserted into your app when AppBuilder creates a build, so there is really not much you have to do aside from including the plugin. BTW, you should look for custom plugins first on the Verified Plugins Marketplace - which includes instructions on including the plugin in your AppBuilder project.