pakage .json file cannot add android platform - ionic4

I cannot able to add android platform in package.json file after installing firebase cloud messaging.
"platforms": [
]
}

This is not very clear what you're saying but the way to add the android platform is to use the Ionic CLI.
You have options to use Cordova or Capacitor.
If you are just starting out it's probably best to use Cordova.
You type this into the command line:
ionic cordova platform add android
The documentation for this command is here:
ionic cordova platform - Ionic Documentation
This will update the json files for you and add all the required configuration.
You should review the documentation though if this is your first time as there are many steps before this to configure your machine:
https://ionicframework.com/docs/installation/environment
https://ionicframework.com/docs/installation/android
https://ionicframework.com/docs/building/android

Related

Implicit PendingIntent Vulnerability error from Google Play Store

Problem Describe:
Recently, some developers have reported that they want to update their app(s) on Play Store,
However, it receives rejection from Google with the title Implicit PendingIntent Vulnerability, said that their app(s) contain an Implicit PendingIntent issue. And they need to fix this issue before the deadlines shown in their Play Console, or app(s) may be removed from Google Play.
Similar Question: Google denied update due Remediation for Implicit PendingIntent Vulnerability
As#tao mentioned, let me post the solution here.
Problem Reason:
HMS Core Push kit earlier than 5.3.0.304 version、Analytics Kit earlier than 6.0.0.301 version and Account kit earlier than 5.3.0.305 version contain the Implicit PendingIntent issue.
Solution:
Push Kit SDK version 5.3.0.304、Analytics Kit SDK version 6.0.0.301 and
Account kit SDK version 5.3.0.305 have been released and fixed the Implicit PendingIntent issue. They've been tested and verified by developers and can be approved by Google for release.
If you are currently using the plug-in(such as React Native, Cordova, Ionic,Flutter), Before the new version of those plug-in released, Huawei also provide a workaround solution(By manually changing the version number).
The following describes the modification method (based on the 5.x plug-in):
React Native:
After the HMS Core plug-in is installed in the RN, the plug-in package is stored in node_modules/#hmscore.
You need to modify the build.gradle file in the node_modules/#hmscore/react-native-hms-account/android directory (taking the Account Kit plug-in as an example):
Open the build.gradle file and change the SDK version in dependencies.
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.huawei.hms:hwid:5.0.3.302'
}
After the update, run the following command to start compilation again. The plug-in downloads the new SDK:
react-native run-android
Cordova/Ionic
If you have installed the plugin as Huawei document describred, the plugin should be saved in node_modules/#hmscore folder.
You need to modify the plugin.xml file in the node_modules/#hmscore/cordova-plugin-hms-push directory. (The following uses the Push Kit plug-in as an example)
Open the Plugin.xml file, search for the keyword framework, and find the SDK to be modified.
<framework src="androidx.core:core:1.3.1"/>
<framework src="com.facebook.fresco:fresco:2.2.0"/>
<framework src="com.huawei.hms:push:5.0.2.301" />
<framework src="resources/plugin.gradle" custom="true" type="gradleReference"/>
Change the version number to the new one and save it.
Go back to the application root directory and delete the platforms/android and plugins/cordova-plugin-hms-push folder.
Run the following command in the root directory:
Cordova:
cordova platform add android
cordova run android --device
Ionic(Cordova):
ionic cordova platform add android
ionic build
ionic cordova run android --device
Ionic (Capacitor) operates in different ways:
①. Delete the capacitor-cordova-android-plugins folder from the android directory.
②. Modify the plugin.xml file according to the description in step 2.
③. Run the following command:
ionic build
npx cap sync
npx cap open android
④. Recompile in the Android Studio
Flutter
You may refer to this answer.
Summary
The plug-ins above are used in open source mode, so developers can modify them directly.
However, the Xamarin plug-in is published in Nuget Package mode. Therefore, you cannot modify the SDK version. If this problem occurs, please feel free to contact us.

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

A dummies guide to installing a PhoneGap plugin

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!

Native: tried calling BackgroundMode.enable, but the BackgroundMode plugin is not installed

I follow https://ionicframework.com/docs/native/background-mode for background mode but i got "Native: tried calling BackgroundMode.enable, but the BackgroundMode plugin is not installed." warning on console error plugin not installed.
1. install ionic cordova plugin add cordova-plugin-background-mode
2. npm install #ionic-native/background-mode
3. import library into app.module.ts "import { BackgroundMode } from '#ionic-native/background-mode/ngx';
" and add into provider.
4. add into main file app.component.ts on this.platform.ready
this.backgroundMode.enable();
console.log(this.backgroundMode.isActive());
If you already are using a mobile device just run:
"ionic cordova prepare android" before running your app.
If you are trying to use this plugins with "ionic serve" you can't you need to use mobile device/simulator or run into the platform browser with:
"ionic serve --cordova --platform browser"
I really don't recommend using browser since it doesn't work very well in my opinion, my suggestion is use a phone.

Installing cordova plugin in MFPF 7.1

can we install Cordova plugin "cordova-plugin-wkwebview-engine" in MFPF 7.1
If Yes, can someone please advise what steps we need to follow.
Thanks,
You can integrate cordova-plugin-wkwebview-engine plugin in your MFP 7.1 Cordova Application by following this blog if the app is built using Mobilefirst Studio Plugin.
If it is MFP 7.1 pure cordova application, you can add wkwebview plugin by running following command in terminal.
cordova plugin add cordova-plugin-wkwebview-engine
Note : MobileFirst Features like Direct Update, Server Notifications might stop working if you are using wkwebview plugin.
cordova-plugin-wkwebview-engine plugin needs cordova-ios >4.0.0.
where as MobileFirst CLI contains an instance of Cordova CLI v5.0.0, and iOS platform version 3.7.0.
for more details see here : link
So it may not work.Try below command if it works
mfp cordova plugin add cordova-plugin-wkwebview-engine