I have made an app using PhoneGap. I need to hide the menu and action bar but the code is not working the way I have it now. Below is the little config.xml to get full screen.
<?xml version="1.0" encoding="UTF-8" ?>
<widget id="com.bensishop.bensishopapp" version="0.0.1">
<name>BensiShop</name>
<description>
Bensishop app
</description>
<author email="info#bensishop.com" href="http://www.bensishop.com">
Bensishop
</author>
<content src="index.html" />
<platform name="android">
<preference name="Fullscreen" value="true" />
</platform>
</widget>
What am I doing wrong or what do I need to add?
Can someone please help me out with this?
Open the project built by phonegap and edit the AndroidManifest.xml file.
Put this in all Activity :
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Related
I tried to build an cordova based android aplication, with "cordova-plugin-media" installed because I want my apps to be able to record my voice.
after the build success with no errors, I run the apps, the recording is working, but my apps become stuck.
The Cordova project was exported from Construct 2, and I've already checked the media permission on export. I've built the apps using SDK via CMD, and also add the "plugin-media" here.
before I add the plugin, the apps run well, but it can't record.
That's why I re-build it with plugin-media attached.
From the result export, I only edit the config.xml on my Cordova project.
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.mawar.speak" version="1.0.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Speech Platformer</name>
<description>
Aplication Description.
</description>
<author email="dummy#gmail.com" href="http://cordova.io">
Node.js
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<!-- fullscreen -->
<preference name="Fullscreen" value="true" />
<!-- orientation -->
<preference name="Orientation" value="landscape" />
<engine name="android" spec="~7.1.1" />
</widget>
What I want is to make my apps run well with plugin-media installed. But when I build with it, it's stuck as I run it on my device.
Sorry for my bad english.
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.
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.
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.
I have followed the very clear instructions on this page:
https://build.phonegap.com/docs/config-xml
I have included the following line in my config.xml file (which is indeed located at the top level of my app):
<preference name="fullscreen" value="true" />
And yet the status bar at the top of the screen remains.
Here is my full config.xml file if it helps..
<?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.universeprojects.voidspace"
versionCode="10"
version = "0.1.2b">
<!-- versionCode is optional and Android only -->
<name>VoidSpace - DevServer</name>
<description>
This is a special version of VoidSpace that connects to the development server.
</description>
<author href="https://voidspace.ca" email="support#universeprojects.com">
Nikolas Gauvreau
</author>
<preference name="EnableViewportScale" value="true" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="false" />
<icon src="icon.png" />
<gap:splash src="splash.png" />
</widget>
Any help is appreciated, thanks!
Just place your config.xml file, modified as you need, at the same directory, as the index.html file:
Note: in this case, we have our application built in the public/ dir. So all the stylesheets and javascripts are already compiled and placed within one.
And now just observe the magic!
Add <preference name="fullscreen" value="true" /> in this path:
res/xml/config.xml.
It really worked for me