Using Apache Cordova Plugins and Cordova Build APK - Forum

Forum Navigation
You need to log in to create posts and topics.

Using Apache Cordova Plugins and Cordova Build APK

Page 1 of 3Next
Hello there

Hello there
I want to use Cordova plugins in my project. Although I go according to the Cordova documentation, but after building the program, the plugin does not work.
Does anyone know how to do this?
I put the required code to install the plugin in the project in the config.xml file.
Please share your information if anyone is familiar with this issue.

Quote from shahram on January 5, 2021, 11:18 am

Hello there
I want to use Cordova plugins in my project. Although I go according to the Cordova documentation, but after building the program, the plugin does not work.
Does anyone know how to do this?
I put the required code to install the plugin in the project in the config.xml file.
Please share your information if anyone is familiar with this issue.

Finally I found the solution.

We can talk more about building mobile apps using Phonegap and Cordova. If anyone has a question or problem in this regard, raise it in this topic.

We can also share our information and experiences in this topic.

Vadim and CDY@44 have reacted to this post.
VadimCDY@44

Please, share your experience, thank you.

Quote from CDY@44 on February 7, 2021, 2:39 pm

Please, share your experience, thank you.

About the previous two posts:

You need to put a file called cordova.js next to the index.html file. I will put this file below for download.

Uploaded files:
  • You need to login to have access to uploads.
Vadim has reacted to this post.
Vadim

If you want to try another method.. I just added the cordova.js link to the body metadata in my VisualNeoWeb App properties.. Like so .. <script src="cordova.js"></script> Compile in VisualNeoWeb, then run your app with Cordova and the installed cordova.js file is included automatically by Cordova and works fine.

 

 

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp
Quote from Darbdenral on February 10, 2021, 10:29 am

If you want to try another method.. I just added the cordova.js link to the body metadata in my VisualNeoWeb App properties.. Like so ..

<script src="cordova.js"></script>

<script src="cordova.js"></script> Compile in VisualNeoWeb, then run your app with Cordova and the installed cordova.js file is included automatically by Cordova and works fine.

 

 

Thanks @darbdenral

So I did, but it doesn't work for me. I will try again.

Quote from Darbdenral on February 10, 2021, 10:29 am

If you want to try another method.. I just added the cordova.js link to the body metadata in my VisualNeoWeb App properties.. Like so ..

<script src="cordova.js"></script>

<script src="cordova.js"></script> Compile in VisualNeoWeb, then run your app with Cordova and the installed cordova.js file is included automatically by Cordova and works fine.

 

 

Dear @darbdenral
You were right. I probably did not notice.
As you said, the cordova.js file will be added to the resources automatically.

Quote from shahram on February 10, 2021, 11:04 am
Quote from Darbdenral on February 10, 2021, 10:29 am

If you want to try another method.. I just added the cordova.js link to the body metadata in my VisualNeoWeb App properties.. Like so ..

<script src="cordova.js"></script>

<script src="cordova.js"></script> Compile in VisualNeoWeb, then run your app with Cordova and the installed cordova.js file is included automatically by Cordova and works fine.

 

 

Dear @darbdenral
You were right. I probably did not notice.
As you said, the cordova.js file will be added to the resources automatically.

Excellent!

I'm glad it worked for you.. :)

Hi,
Can you describe in detail the process to use this in a VisualNeo Web App ?

I have ni idea how to proceed....

Thank you !

It's a pretty large task to get setup ..

The first steps.. is to install Android Studio, Node.js and Cordova.

Android Studio Download
https://developer.android.com/studio/install

Node.js
https://nodejs.org/en/download/

Cordova
https://cordova.apache.org/docs/en/10.x/guide/cli/index.html
C:\>npm install -g cordova

After that I've attached here a sample Hello World VisualNeoWeb app that should jumpstart you on your way..
Unpack the app where you store your VisualNeoWeb apps.

Next  create a folder for the App output..
HelloWorld
open a cmd console in the HelloWorld folder

Run: cordova create helloWorld org.apache.cordova.helloWorld helloWorld
Run: cordova platform add android

Now go into VisualNeoWeb
Compile the app to the HelloWorld/www folder that you just created with Cordova

Now in the console lets run it
cordova run android

If you did everything correct, the app should come up inside the emulator..  If the emulator never starts, start it manually then try again.

I wrote this kind of fast.. I may do a video later.. getting late here now..

let me know how it goes..

 

 

Uploaded files:
  • You need to login to have access to uploads.
luishp and YASIN have reacted to this post.
luishpYASIN

Also check the following attached file paths and correct as needed for your system, then save and compile..

 

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

Thank you so much @darbdenral, I will see all of that !

Best regards,

I have moved this thread to a new specific forum section.
I'm very interested in optimizing VisualNEO Web for Apache Cordova deployment.

Thank you @darbdenral and @shahram!!

CDY@44 and shahram have reacted to this post.
CDY@44shahram
Quote from luishp on February 10, 2021, 2:07 pm

I have moved this thread to a new specific forum section.
I'm very interested in optimizing VisualNEO Web for Apache Cordova deployment.

Thank you @darbdenral and @shahram!!

Thank you @luis

Quote from Darbdenral on February 10, 2021, 1:16 pm

It's a pretty large task to get setup ..

The first steps.. is to install Android Studio, Node.js and Cordova.

Android Studio Download
https://developer.android.com/studio/install

Node.js
https://nodejs.org/en/download/

Cordova
https://cordova.apache.org/docs/en/10.x/guide/cli/index.html
C:\>npm install -g cordova

After that I've attached here a sample Hello World VisualNeoWeb app that should jumpstart you on your way..
Unpack the app where you store your VisualNeoWeb apps.

Next  create a folder for the App output..
HelloWorld
open a cmd console in the HelloWorld folder

Run: cordova create helloWorld org.apache.cordova.helloWorld helloWorld
Run: cordova platform add android

Now go into VisualNeoWeb
Compile the app to the HelloWorld/www folder that you just created with Cordova

Now in the console lets run it
cordova run android

If you did everything correct, the app should come up inside the emulator..  If the emulator never starts, start it manually then try again.

I wrote this kind of fast.. I may do a video later.. getting late here now..

let me know how it goes..

 

 

Thanks @darbdenral

but I think its not necessary to install visual studio.

I've just installed these packages:

Android SDK

Java Development Kit 8 (Its important to install version 8)

NodeJS.exe- v 14.15 (latest version have some bugs)

Git.exe

Gradle (it seems it depends on Android API but I'm not sure)

then you have to set Environment Variable System for ANDROID SDK, JDK and GRADLE path.

as well as you need to make some changes in config.xml.

 

Darbdenral has reacted to this post.
Darbdenral

Here are the things I do to build an app using Cordova: (PART 1)

  1. Download and unzip Android SDK Packages on hard drive*(Also you can use SDK Manager)
  2. Install JDK version 8
  3. Install Git.exe
  4. Install NodeJs.exe version 14.15
  5. Download Gradle (I'm using version 6.8), and unzip.
  6. Set ANDROID_HOME, JAVA_HOME and GRADLE environment system variables path based on the guide in this link
  7. Restart system
  8. open CMD and type: npm install -g cordova (It will install Cordova on your system)
  9. you can check if these package are installed on your system, by type (cordova -v, java -v, gradle -v) in the cmd.
Darbdenral and YASIN have reacted to this post.
DarbdenralYASIN

Here are the things I do to build an app using Cordova: (PART 2)

  1. Add this tag in body: <script src="cordova.js"></script>

metatag

Compile project for Mobile Application by Project> Compile\Publish

CompileWindow

2. After Compile you will have a Zip file named your project.

3. Unzip Zip file and Rename the folder to "www"

4. move config.xml from www folder, next to the "www" folder. so you will have a structure like this:

FolderStruct

and inside www folder we'll have:

www folder structure

5. Open config.xml and change contents with below : You can change the red texts with the desired information. as well as other settings based on the guide in this link

.....................................................................................

<?xml version="1.0" encoding="UTF-8" ?>
<widget id="com.cordova.VisualNeo" version="0.0.1" android-versionCode="13" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

<name short="APP SHORT NAME">APP FULL NAME</name>
<author email="YOUR EMAIL" href="YOUR WEBSITE">YOUR NAME</author>
<icon src="www/img/ICONNAME.png" />
<content src="index.html"/>
<access origin="*"/>
<cdv:platform name="android"/>

<preference name="orientation" value="default" />
<preference name="android-targetSdkVersion" value="29" />
<preference name="android-minSdkVersion" value="22" />
<preference name="fullscreen" value="false" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />

<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>
</widget>

..............................................................................................

5. make a simple text file named compile next to the config.xml and www folder, and add these commands in it. then save it as a "bat" file (compile.bat): "Take a look at this link for more information."

....................................................................................
@ECHO OFF
CLS

CD %~dp0

CALL cordova platform add android

CALL cordova plugin add cordova-plugin-device

CALL cordova plugin cordova-plugin-statusbar

CALL cordova plugin add cordova-plugin-whitelist

CALL cordova build android

PAUSE

............................................................................

6. now run "compile.bat". If there is no problem, an APK file will be created after the compilation process.

 

Darbdenral and YASIN have reacted to this post.
DarbdenralYASIN

Hi,

Please up a Compiled Apk with Cordova

Thank You

Quote from farhad2008 on February 11, 2021, 1:56 pm

Hi,

Please up a Compiled Apk with Cordova

Thank You

Hi Farhad

here you go...

Minimum android Version: 5.1

 

Page 1 of 3Next