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.
Related
Recently I created a Cordova app for my html5 game created in Cocos Creator engine.
After some time, I noticed the app running on android not as smooth as in browser. I googled a lot of questions but all they said problem is Cordova using some default Web View what have bad performance. I tried a lot of solutions, but no one helped me.
Today I noticed, when I run my app, touch screen and don't leave my finger, the app starts to run very smoothly (as in browser). I am wondering what is the reason of such behaviour?
Maybe there is some acceleration what start to run only when I touch the screen?
Also, any advices how I can fix lagging in Cordova android build are welcomed.
Solutions I tried:
Plugins:
ionic-webview,
crosswark-webview
setting
android:hardwareAccelerated
true/false
in the manifest
Some other small solutions from internet, I currently can't remember. No One of this helped my. Only when I touch the screen I see performance boost.
This issue occurs only on my new phone (was bought in 2020),
in the old one (2017) app runs smoothly without touch.
Thanks!
UPDATE
Cordova version is 10.0.0 (cordova-lib#10.1.0)
Platform android version is 9.1.0
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.android.m" android-versionCode="6" id="com.android.m" version="1.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>My game</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="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="AndroidXEnabled" value="true" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="orientation" value="portrait" />
<preference name="Fullscreen" value="true" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
I am new to Cordova and am busy with some courses. Please be kind.
I am trying to create an APK that is for Android version 4.3 (Yes, it is old! But this is the only version these devices runs on).
I have read that one must change the config.xml with the necessary build details to build for a specific version, but I am simply not managing. The produced APK can be installed on my phone, but I cannot even see the APK on the device. The only reason I think is because of the APK version.
I am using VS Code and Android Studio (for the emulators).
What do I need to change, install etc., to build an Android 4.3 APK?
Do I need to install a different Cordova (I have the latest)?
Do I need to install a different Android version for Cordova (cordova platform add android)?
Do I need to install a specific Android studio API, and how?
Do I need to change my config.xml?
Here is my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test.ngcordova" version="4.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ngCordova</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="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<engine name="ios" spec="~4.5.4" />
**<engine name="android" spec="~4.0.0" />**
</widget>
Note: This line changes back to <engine name="android" spec="^7.0.0" />when I run a build.
Here is a link to my Angular 4 and Cordova Boilerplate app
Have you tried to remove android platform and then adding the specific platform with the following command 'cordova platform add android#x.x.x' (replacing x.x.x with your version)? Sometimes it overwrites what you have typed in the config.xml when you run the app.
To check if you have the specific API installed you can open the SDK Manager, Android Studio -> Configure -> SDK Manager -> in SDK Platforms you can check if you have Android 4.3 installed. If not, install it. But if you don't have it, you should get an error when you are trying to run the app.
Also, do you get any errors when you are trying do a build?
Hello I have an app developed in phonegapbuild in version 3.7 and it works very well but if I upgrade to version cli-6.0.0 stops working.
this is my config is very simple.
<?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.entre5.movil”
versionCode = “10″
version = “1.0.0″>
<name>Entre app</name>
<description>
Desarrollo personalizado ph
</description>
<author href=”https://phonegapspain.com” email=”soporte#phonegapspain.com”>
crecerweb
</author>
<preference name=”phonegap-version” value=”cli-6.0.0″ />
<preference name=”fullscreen” value=”false” />
<preference name=”prerendered-icon” value=”true” />
<content src=”index.html”/>
<platform name=”android”>
<icon src=”mdpi.png” qualifier=”ldpi”/>
<icon src=”hdpi.png” qualifier=”mdpi”/>
<icon src=”xhdpi.png” qualifier=”hdpi”/>
</platform>
<access origin=”*” />
</widget>
index.html
<script src=”phonegap.js”></script>
but does not work and you put a plugin like geolocalitation not it works is like no load something .
If suddenly someone already solved thank the guide.
regards
hello already solved and what happens is that after the clip 5 version to load jquery and other external files must be taken into account.
<gap:plugin name=”cordova-plugin-whitelist” source=”npm” />
<access origin=”*” />
<allow-intent href=”*” />
<allow-navigation href=”*” />
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 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.