Android by HTML5 / CSS3 / JavaScript - javascript

Can I create Android applications with HTML5, CSS & JavaScript? Such as (News application, books library, 2D & 3D Games and etc) How can I do?
And what is the platform used?

A simple platform to use would be the cordova platform.
Simple tutorial found here: https://cordova.apache.org/docs/en/latest/guide/cli/
Install Cordova:
npm install -g cordova
Create project:
cordova create CordovaApp
Upon creating the application you will notice a 'www' folder. Inside you will find the html, css and js files and folders. Modify those according to your requirements
Add Target Device Platform:
cordova platform add ios
or
cordova platform add android
Build the app:
cordova build
Run the app:
cordova run android or cordova run ios

Related

How do you deploy React (non-Native) app to Android?

I've created a React app that looks great on mobile, but rather than a user just visiting my website URL I also want them to be able to install it as an apk through the playstore.
Is there any trivial way to port it to Android, that would allow me to continue to develop just one version of the app? I looked into porting it to react-native, but much of it would need to be recoded. I also considered just opening the app URL in a browser popup, but I'm wondering if there's a better way.
Thanks -
Edit: Based on Michael's comment, I'm trying out turning my app into PWA compliant, then using Capacitor to deploy on Android & iOS. I'll see how this goes and write my own answer if this works out (and no one else answers =o)
Forgot about this question. As the OP in 2021, I resolved this by using Capacitor - A Javascript library that converts your app to Android and iOS builds.
Install Capacitor: npm install #capacitor/core #capacitor/cli
Initialize it: npx cap init
Add Android and (optionally) iOS support: npx cap add android npx cap add ios
Create an Android app: npx cap sync
Open Android Studio with your new app (to build a .APK): npx cap open android
Optional: Open Xcode to build an iOS app: npx cap open ios
Source: https://capacitorjs.com/docs/getting-started

Create a APK using Javascript UI

If you have a javascript UI and would like to create an APK for Android devices. Please advice how could i compile to get APK.
Use Cordova: cordova.apache.org
Just follow the steps for installation, turn your JavaScript project into a Cordova project with cordova run Android and then build the APK with cordova build android.

What does cordova prepare and then run vs cordova platform add and then run?

I checked the documentation but didn't find a clear explanation about when to use those commands:
cordova platform add android && cordova run android
cordova prepare android && cordova run android
In the documentations the run command does this:
Run project (including prepare && compile)
run is already running prepare. So, is there any case where I need the option 2? To me it looks like it doesn't make sense if I'm using run after that.
Thank you in advance for your valuable time : )
Adding a platform in Cordova does not run the prepare command which will run hook scripts.
Assuming the android platform is not already added, this will generate the directory platforms/android and populate it with a complete standalone Android project. Cordova plugins that have been installed will also be installed into the Android project. cordova run android will run cordova prepare android followed by cordova build android, then proceed to install and run the application. If the android platform is already added Cordova will throw and error.
This command is redundant, and, assuming the android platform has already been added, will run cordova prepare android twice followed by cordova build android, then install and run that application. If the platform is not added Cordova will throw an error.
Conclusion
It makes little sense to differentiate between the two command sequences you provided as they seldom need to be executed. You usually only add a platform once, and you can just call cordova run android without needing to call cordova prepare android before it unless you intend to use cordova build android manually (potentially as a signed release) followed by using adb or saving/deploying the generated APK without needing to do a full blown run.
Regarding option 1, if you already have one android platform, it will fail due to
"cordova platform add android" command and not "cordova run android"
Regarding option 2, even if there is no android platform,it will work
Tried with cordova version = 10

Structure of codebase to build for multiple platforms from one codebase in VuetifyJS/VueJS

I would like to use the VuetifyJS/VueJS templates to build a Web app (PWA), Android app (Cordova) and Desktop app (Electron) from one codebase.
What is the best way to structure the main codebase to easily create the built for each platform?
Well, if you use Cordova you should place your build files in the dist folder, as you are used to. Then I do the following:
After Installing Cordova initialize in your project
cordova create mobile com.f1lt3r."${PWD##*/}"
cd mobile
Lets add the Android platform
cordova platform add android
This creates a mobile folder with the Cordova project in it. Next, create a symbolic link from your project build files to the Cordova web root.
cd ..
rm -rf mobile/www/*
ln -s $(pwd)/dist/* $(pwd)/mobile/www
Now, for Electron you could take a look at the config files of SimulatedGREG/electron-vue, I am not too familiar with this, but I think it would be possible to do something similar as with Cordova.

Build Apk of JS Application

I Try To Build An Android App with JS
I Want To Build An Apk Of My HTML , CSS , JS Apllication
How Can I do ?
Note : i want Apk File For Android App Stores Not Only Mine
For a native way you should look at: Building Web Apps in WebView
For a framework way of building it look at:
Apache Cordova: http://cordova.apache.org
or Phone gap: http://phonegap.com

Categories