A dummies guide to installing a PhoneGap plugin - npm

I am trying to build a basic QR code scanning app but I am not exactly sure how to add a plugin. I am trying to install - https://www.npmjs.com/package/cordova-plugin-barcodescanner
I have installed NPM, GIT and Cordova, and have deployed a Framework 7 based app from the phonegap software that has the following directory:
C:\Users\user\Documents\Phonegap Apps\Saving Energy\Android
I am unsure how to install the plugin? Do I run
npm i cordova-plugin-barcodescanner
in Windows Command Prompt, and if so do I have to change the directory to my app plugin folder? Do I run it using node.js? Etc.

You can add plugin easily using cordova
you should open command prompt with Saving Energy as directory and run
cordova plugin add [cordova-plugin-name]
For your case it is
cordova plugin add cordova-plugin-barcodescanner
Hope it Helps!

Related

Cordova plugin with Capacitor and Quasar

I'm building an app with Quasar and Capacitor.
I'd like to use phonegap-plugin-barcodescanner(or is there any other option for QR reading?).
I've installed plugin with npm i phonegap-plugin-barcodescanner to src-capacitor project. What's my next steps, do I need to register it in capacitor.config?
How do I call scan function on it?
I've figured it out. You need to run npx cap sync in src-capacitor folder. And than the plugin accessible via cordova.plugins.barcodeScanner like it was previously with Cordova

compile apk on a folder "Android" already created previously in react-native

I'm new to react-native, I've seen tutorials but everyone uses expo. I downloaded this project where they don't use expo. I want to compile this application for android, to finally get an .apk
This application already has a folder called "Android" but inside it does not have its respective .apk. How can I generate it?
this is the repository:
https://github.com/zsajjad/BusinessCard
It would be great if you can attach screenshots of how I should do it
Note. I have the latest version of android studio and I don't see the option of "build"
commands like "gradlew" from the console, they don't work, it's as if I didn't have that command installed
Following instructions for build apk using android studio
Hope you installed node and react native on your machine. If not
please follow the link to install it.Install node and react native
open your command prompt or terminal and redirect to your download project - cd /Businesscard Master (change it according to your project location)
Now enter - npm install
Enter - react-native link
Follow the android related linking instructions on following link react native camera
Hope you know about android camera and storage permissions.
same thing for react native text detector. Because your downloaded project have that packages in package.json
Now open your project android folder in android studio using open existing android project.
Then select build your project from android studio build menu and run it also
Generate apk using build menu- same process you have to follow for native android project
You don't need to use the CLI, that's needlessly complicated and it obscures what Android Studio is actually doing. Here's all you need to do.
Open the whole /Android/ folder in Android Studio. This is your "project" similar to how you open a *.xed file in XCode. Except in Android Studio, you just open up the whole folder to get the build.
Android Studio will now prepare your project using Gradle. If there are any errors in the preparation it will tell you about them. Assuming your gradle and Android Studio versions are compatible and you got no errors, you're now ready to emulate, debug and create a production build. At this point the workflow is similar to using XCode. You'll see emulators under Tools -> AVD Manager.
In the file menus go to Build->Generate APK. You can choose between signed APKs, debug APKs and so on. You'll need the key file if you're signing the APK on your computer, otherwise there's also Google Play signing after you upload the APK.
TL;DR: Just open your /Android/ folder in Android Studio.
Side note: When Android Studio gives you popups to upgrade stuff don't do it. NEVER upgrade Gradle or Android Studio unless the RN / Expo team specifically ask you. This will break your whole project and you will need to rebuild the platform.

error in setting of android in sdk and gradle to run cordova comand in ionic

I’m setting up a new apk in ionic and want to run app in mobile to release apk
. This is windows
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=D:\sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
If you are using Cordova version >= 7 or Android SDK Tools >= 26 you need to manually install gradle (reference). On Windows you can install gradle like this:
Download the binary release from https://gradle.org/releases/
Unzip it to any folder you like, for example C:\gradle
Edit your system environment variables to include the directory C:\gradle\bin (where gradle.bat is located`)
Afterwards you should be able to build your project normally.

No option for adding New flutter Web Project in IntelliJ Dart Templates !!! Also tried Vs code, is asking for Which Dart template

I'm trying to start a new Flutter project in Intellij as well as Vs code.
Intellij there is no option provided to add a new flutter web project in Dart templates.
Vs code whenever I select New flutter Web Project after accepting the stagehand it asks for the Dart template which is why I'm stuck.??
Please help soon??
Since flutter 1.9 flutter_web is merged inside flutter, Follow the below steps to create and run your first flutter web App through IntelliJ IDEA.
Create a new flutter project.
Now change your flutter channel to master using flutter channel master
Upgrade flutter flutter upgrade
Install the flutter_web build tools flutter pub global activate webdev
Enable flutter web using flutter config --enable-web
Check available devices flutter devices and you will get a result like:
Chrome • chrome • web-javascript • Google Chrome 81.0.4044.92
Web Server • web-server • web-javascript • Flutter Tools
Inside your flutter project create myapp using flutter create myapp
Navigate inside myapp using cd myapp
Finally, run flutter run -d chrome
And you will be able to run your flutter web app into chrome. Hurray 🤟🏽🤟🏽🥳
Reference links: Building a web application with Flutter , flutter_web
It seems that the support for Flutter Web Apps was dropped in stagehand (that contains the dart templates). From this commit on github: (Dropping Flutter Web sample). Instead, this wikipage shows how to migrate/create a web package in flutter from command line.
Create your project from command-line.
Check out this tutorial. flutter.dev/docs/get-started/web
Then just open the project in IntelliJ IDE.
Install or Update the dart and flutter plugins in Intellij and/or VS Code
For Intellij
Go to [mac] Preferences>Plugins>Marketplace and search for Dart and Flutter, install it.
For VS Code
Go to View > Command Pallet and type in Extensions: Install Extensions
then type flutter and install it
Its well documented in this link
Setup Flutter

Cordova - Windows8 does not recognise navigator.notification.alert

I am having a hard time getting cordova to work as I expect.
Here are the steps I have taken.
npm install -g cordova
md apps
cd apps
cordova create win8 com.win8.tryout win8tryout
cordova platform add windows8
In the www/js folder I edited the index.js adding
navigator.notification.alert('try me out');
to the device ready event.
Then I build the cordova project from the apps/win8 folder
cordova build
Then I opened the visual studio solution in the platforms/windows8 folder and ran the application.
The code fails at the navigator.notification.alert('try me out'); line with
"JavaScript runtime error: Unable to get property 'alert' of undefined or null reference"
I suspect that the build process isn't working correctly because the cordova.js file in the windows8/www directory is only 52kb and I was expecting a file of about 300kb.
Any ideas or suggestions would be appreciated.
Ok so a bit more research and I realised my sort comings.
From the documentation here:
"From version 3.0 onward, Cordova implements all device APIs as plugins..."
I had originally downloaded v2.9.1 which did not implement the plugin architecture.