I am Using PhonegapBuild Not eclipse for build my application.
We are not using any custom plugin. I read the post about plugin but i think it's for custom plugin so i didn't change anything in XML and it gives me error "plugin unsupported: splashscreen" So can any one help me how to get rid of it.
In Config.xml splash plugin line is same as mentioned in docs and it's as below
For Android:
<gap:plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
For IOS:
<gap:plugin name="SplashScreen" value="CDVSplashScreen" />
Please help me..
Screenshot is below
I removed all plugin from my config.xml for Android as well IOS also.Then i successfully upload my Zip file for Build and its Build and Working Fine in Device..
As far as I can tell, you must be confused with the feauture and the plugin
Try using the following for the feauture
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.SplashScreen"/>
</feature>
<feature name="SplashScreen">
<param name="ios-package" value="CDVSplashScreen" />
</feature>
Try using the following for the plugin
<gap:plugin name="cordova-plugin-splashscreen" source="npm" version="2.1.0" />
But I also have a problem with my splashscreen, so it may not be 100% correct. My problem is that my images are not being recognized.
Related
I upgraded today to the newest Cordova - 5.4.1. App on iOS kept working just fine but not on Android. All requests were returning 404 error, so I dig into the topic and found out that I need "cordova-plugin-whitelist". I installed it and added
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'">
to the header of index.html as well as <access origin="*" /><allow-navigation href="*"/> to config.xml
and now every request to external world is returning "net::ERR_NAME_NOT_RESOLVED"
In AndroidManifest.xml I have those two lines so I guess it's not a problem with Internet access.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
I went through many questions on SO related to cordova-plugin-whitelist but nothing seems to work
My config.xml
```
<?xml version='1.0' encoding='utf-8'?>
<widget id="app" version="1.1.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" />
<allow-navigation href="*" />
<platform name="ios">...splash screens and icons</platform>
<platform name="android">...splash screens and icons</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="Orientation" value="default" />
<feature name="phonegap-parse-plugin">
<param name="id" value="org.apache.cordova.core.parseplugin" />
<param name="url" value="https://github.com/fastrde/phonegap-parse-plugin" />
</feature>
<feature name="Insomnia (prevent screen sleep)">
<param name="id" value="nl.x-services.plugins.insomnia" />
<param name="url" value="https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git" />
</feature>
<feature name="Toast">
<param name="id" value="cordova-plugin-x-toast" />
<param name="url" value="https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git" />
</feature>
<feature name="Cordova SMS Plugin">
<param name="id" value="com.cordova.plugins.sms" />
<param name="url" value="https://github.com/cordova-sms/cordova-sms-plugin.git" />
</feature>
<feature name="OpenTokCordovaPlugin">
<param name="id" value="com.tokbox.cordova.opentok" />
<param name="url" value="https://github.com/doxyme/cordova-plugin-opentok" />
</feature>
</widget>
```
I have no idea what the issue was but restarting device resolved it. Nothing related to the app, just the phone had difficulties with connecting to Internet even though it was connected to Wi-Fi and signal strength seemed to be on max.
In your app's 'config.xml', place only this:
<allow-navigation href="*" />
And remove what you added to your index.html header.
Then if it still doesn't work that means your problem is not related to the whitelist plugin.
I used this plugin in different Android projects and never had to do more than this to allow my app to communicate with the back-end.
Hope that helps!
We ran into a similar issue where we received the "Failed to load resource net::ERR_NAME_NOT_RESOLVED" error on two different systems from the android emulator running in HAXM using Cordova 6.4.0 and the version 25 (7.1.1) android SDK. Simply removing and adding the whilelist plugin resolved our issue without changing any configuration files.
I was having the same issue and nothing seemed to solve... And I figured out that in my case was the splashscreen image size that was too big (about 3.2MB)... I used this website to compress the file and then worked.
Restarting Device seems to resolve this problem for me locally, but this piece of work always comes back to me from support. So would like to have a fix for the solution not a workaround.
The whitelist plugin also has Content Security Policy declarations:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
This seems to have resolved the issue for me, but only time will tell as I can never get this issue to replicate on demand.
For me, none of the mentioned solutions worked. What worked for me was adding the plugin directly from the repo:
cordova plugin rm cordova-plugin-inappbrowser --force
cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
If the problem persists you can go ahead and remove and add the platform again:
cordova platform save
cordova platform rm <platform>
cordova platform add <platform>
It seems you are trying to send requests yet you are offline, try to check internet connection.
I am writing a Cordova plugin for Android, and it is not registering a JavaScript object to window and I would like to know why.
In the plugin's plugin.xml, I am using <js-module> to register the js object to window object:
<platform name="android">
<js-module src="www/Loading.js" name="loader">
<clobbers target="loader" />
</js-module>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Loading">
<param name="android-package" value="org.apache.cordova.loader.Loading" />
<param name="onload" value="true" />
</feature>
</config-file>
...
</platform>
The plugin compiles, but when I do window.loader in Chrome debugger, it is undefined. I tried changing the value of target in <clobbers> to window.loader to no avail.
www/Loading.js file is exporting a JavaScript object using module.exports:
function Loading() {
...
}
module.exports = new Loading();
Any suggestions?
Resolved. This is a very specific case for my app. I am copying everything from the sandboxed environment to an internal path and booting the app from the internal path. Turns out the app was not copying the www/Loader.js file.
I tried other solutions around here but no matter what I do the same permissions are asked during install of my app.
I tried removing a bunch of the "plugins" phonegap uses, namely: (from the config.xml)
<gap:plugin name="org.apache.cordova.battery-status"/>
<gap:plugin name="org.apache.cordova.camera"/>
<gap:plugin name="org.apache.cordova.media-capture"/>
<gap:plugin name="org.apache.cordova.contacts"/>
<gap:plugin name="org.apache.cordova.geolocation"/>
<gap:plugin name="org.apache.cordova.globalization"/>
Yet when I update my code and then try to install the apps it still asks for stuff like location.
Anyone who knows this?
It isn't the plugins that declare the permissions. The permissions are declared with feature elements like
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/device"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/network"/>
I developed a cordova app which uses the contacts plugin. I tested it on android with my linux machine and everything works fine. Now I am trying to use phonegap build to create an ios package. My problem is with the contacts plugin, the code for getting contacts doesn't work when I use it in IOS. I tried adding this line to my config.xml:
<gap:plugin name="org.apache.cordova.contacts" version="0.2.11" />
But it didn't help.
The UI also looks different (everything is smaller). This is not an IOS compatibility issue - I tried the apk created by phonegap build for android on the same android phone I used for development and the UI has the same problems it had on IOS. What am I doing wrong?
Thanks.
Try adding this to config.xml
<feature name="Contacts">
<param name="ios-package" value="CDVContacts" />
</feature>
For android you have to use this
<feature name="Contacts">
<param name="android-package" value="org.apache.cordova.ContactManager" />
</feature>
Please refer this for more details
http://docs.phonegap.com/en/3.0.0/cordova_contacts_contacts.md.html
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.