{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Article Introduction
In this article we will show how to integrate Huawei Scan Kit in iOS using native language (swift) and barcode lookup APIs to search and add items with information in your list. The use case has been created to make Smart Shopping Cart with HMS open capabilities.
Huawei Scan Kit
Huawei Scan Kit supports 13 mainstream formats including QR Code, Data Matrix, PDF417, Aztec, EAN-8, EAN-13, UPC-A, UPC-E, Codabar, Code 39, Code 93, Code 128, and ITF. It detects barcodes despite low visibility, glare, damage, distortion, or blur. It also supports Auto Zoom into small and distant barcodes. It can easily processes up to 5 barcodes simultaneously.
Scan Kit can be called in three ways, from which you can choose as needed.
For this article, we implemented Default View for iOS with native Swift language. In Default View mode, Scan Kit scans barcodes using the camera or from images in the album, and also provides a complete scanning UI that can be directly used. You do not need to worry about designing a UI as Scan Kit provides one.
Pre-Requisites
Before getting started, following are the requirements:
Xcode (During this tutorial, we used latest version 12.3)
iOS 9.0 or later (Scan Kit supports iOS 9.0 and above)
Apple Developer Account
iOS device for testing
Development
Following are the major steps of development for this article:
Step 1: Importing the SDK in Pod Mode
1.1: Check whether Cocoapods has been installed:
gem -v
If not, run the following commands to install Cocoapods:
Code:
sudo gem install cocoapods
pod setup
1.2: Run the pod init command in the root directory of the Xcode project and add the current version number to the generated Podfile file.
pod 'ScanKitFrameWork', '~> 1.0.2.300' # Huawei Scan Kit dependency
pod 'Alamofire', '~> 5.2' # Optional: Swift Network call lib dependency
pod 'AlamofireImage', '~> 4.1' # Optional: Swift Image loading lib dependency
pod 'SwiftyJSON', '~> 4.0' # Optional: Swift JSON parsing lib dependency
pod "TTGSnackbar" # Optional: Swift Snackbar lib dependency
pod 'lottie-ios' # Optional: Swift Lottie animation lib dependency
1.3: Run the following command in the same directory of the Podfile file to integrate the HMS Core Scan SDK:
pod install
If you have used Cocoapods, run the following command to update Cocoapods:
pod update
1.4: After the execution is successful, open the project directory, find the .xcworkspace file, and execute it.
Step 2: Assigning Permissions
You need to assign permissions required by your app to call Scan Kit.
To scan barcodes using the camera, you need to add Camera Usage Description (camera permission).
To scan barcodes from images in the album, you need to add Photo Library Usage Description (image read permission).
Open the info.plist file and add the following content:
Step 3: Building Layout
We used Auto Layout. Auto Layout defines your user interface using a series of constraints. Constraints typically represent a relationship between two views. Auto Layout then calculates the size and location of each view based on these constraints. This produces layouts that dynamically respond to both internal and external changes.
In this article, we also used Lottie animation for empty cart list and for the searching animation when user scan barcodes.
Code:
// This extension is responsible to manage all the lottie animation methods
extension HomeViewController {
func setDefaultAnimation(){
if(self.addedItems.count > 0){
showResults()
} else {
noItemFound()
}
}
func noItemFound(){
DispatchQueue.main.async {
self.homeTableView.isHidden = true
self.animationView.isHidden = false
self.animationView.animation = Animation.named("empty_view")
self.animationView.contentMode = .scaleAspectFit
self.animationView.loopMode = .loop
self.animationView.animationSpeed = 1.5
self.animationView.play()
}
}
func showLoading(){
DispatchQueue.main.async {
self.homeTableView.isHidden = true
self.animationView.isHidden = false
self.animationView.animation = Animation.named("not_found")
self.animationView.contentMode = .scaleAspectFit
self.animationView.loopMode = .loop
self.animationView.animationSpeed = 1.5
self.animationView.play()
}
}
func showResults(){
DispatchQueue.main.async {
self.homeTableView.isHidden = false
self.animationView.isHidden = true
}
}
}
More information, you can check https://forums.developer.huawei.com/forumPortal/en/topic/0203446609479290092
It will support all languages ?
Very nice and useful for many applications with an online database.
how can i use customised API in the application?
Related
This is originally from HUAWEI Developer Forum
Forum link: https://forums.developer.huawei.com/forumPortal/en/home
Introduction
HUAWEI Wallet Kit providing users to claim passes of merchants, like loyalty cards, gift cards, coupons, boarding passes, event tickets, and transit passes. It provides easy-to-access digital passes on an integrated platform. It enables user save their cards into mobile phones for convenient. The interaction between apps and users via location based notifications.
Integration Process.
The Wallet Kit integration process consists following steps
1. Generating Public and Private Keys
2. Adding Pass type on the AGC
3. Running the Server Demo code
4. Running the Client Demo code
5. View card adding status
Step-1: Check Below Link to generate keys & App Configuration in AGC:
LINK: https://forums.developer.huawei.com...d=0201242460338530108&fid=0101187876626530001
· Let’s see how to apply new wallet.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
· Now will see how to create Flight ticket.
· Service type consists 3 types
1. Card
2. Coupon
3. Ticket
· Service item will change based on service type
· Service name should be Unique
· Service Id should be unique it will start will always hwpass
· Public key we need to get it from RSAUtils
· Click next button and save details. The service application procedure is now complete. After applying for the service, you can view, edit, and delete it on the HUAWEI Wallet Kit service application page
Step-2: Server Side Integration:
Download server demo code check below link.
Link: https://developer.huawei.com/consumer/en/doc/development/HMS-Examples/wallet-sample-code
1. Download maven dependency.
2. Configure your project into IntelliJ IDEA
3. Download required dependencies and import
4. Sync your project
5. Open release.config.properties and replace appId & secret Key
6. Compile project using terminal mvn clean compile
7. After completion of compilation automatically Target folder will generate
Follow below steps
Copy hmspass folder in the config directory, paste into the target/classes directory.
You can run the source code, you can run mainly java files in the Test folder.
Check below steps and modify accordingly.
· The file ends with ModelTest provides the examples of adding, modifying and pass models.
· The file name ends with InstanceTest provides the examples of adding, modifying and pass instances.
Step-3: Generate Pass Model:
· Open FlightModel.json file
· PassTypeIdentifier is unique which you mentioned service Id in AGC both needs to match
· You have to modify passTypeIdentifier and passStyleIdentifier when we add card types on the AGC PassStyleIdentifier field is unique.
· After completion of modify execute createFlightModel()
· Open the HwFlightModelTest file and Run CreateFlightModel() method
Code:
Test
public void createFlightModel() {
System.out.println("createFlightModel begin");
// Read an example flight model from a JSON file.
String objectJson = CommonUtil.readWalletObject("FlightModel.json");
HwWalletObject hwWalletObject = JSONObject.parseObject(objectJson, HwWalletObject.class);
String modelId = hwWalletObject.getPassStyleIdentifier();
System.out.println("modelId is: " + modelId);
String instanceId = hwWalletObject.getSerialNumber();
// Set parameters of the flight model you want to create. Flight instances belong to this model share these
// parameters.
WalletBuildService walletBuildService = new WalletBuildServiceImpl();
HwWalletObject requestData = walletBuildService.createHwWalletObject(objectJson, instanceId, modelId);
// Validate the parameters.
boolean validateModel = HwWalletObjectUtil.validateWalletModel(requestData);
if (validateModel) {
// Post the new flight model to the wallet server.
String urlParameter = "flight/model";
HwWalletObject flightModel = walletBuildService.postHwWalletObjectToWalletServer(urlParameter, requestData);
System.out.println("createFlightModel JSON is: " + CommonUtil.toJson(flightModel));
System.out.println("createFlightModel end");
}
}
This is not all. For full content, you can visit https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201254289105300220&fid=0101187876626530001
This is a great solution for wallet and loyalty apps that want to stay away from GMS.
More information like this, you can visit HUAWEI Developer Forum
Intro
In this article I would like to address the HMS topic in Unity Engine. Unity is widely used in the world of video game development. With the help of the plugin developed by EvilMindDevs the integration of the HMS sdk is easier. Although the documentation of the plugin is quite explicit in this tutorial i want to review the implementation within a game. The game is very simple, A car which we must control by swiping to right or left. When losing, a menu where we can login to our HMS account with the help of the plugin. Without further introduction let's go to the article.
Steps
1. Download the code from the repository
2. Create our application in AGC
3. Creating Keystore whitin Unity
4. Obtaining the SHA256 number
5. Finishing the configuration in AGC
6. Let's download the plugin
7. Setting up json Services
8. Adding data of our App to the Plugin
9. Adding the Account Manager prefab to the scene
10.Adding a button to the "End of Game" Canvas
11. Adding neccesary objects
12. Creating an AuthPara class to manage Authentication
1.-Download the repository code
https://github.com/ADX2099/Unity-HMSAUTH
2.- Create our application in AGC
To implement the plugin we must create an App on our console
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click on My apps
Choose New app and fill App data, this time we must select Game in App Category. Once the App is created, what we will do is go to the develop tab and place the name of our package. Choose the one that suits you best, within this tab is where we will find the necessary data to implement the plugin.
3.-Creating the Keystore in Unity
Now we have to open Unity and start to configure the project, to achieve this we must go to File -> Build Settings -> Player Settings
Within Player Settings we must look for the Publishing Settings tab and open the KeystoreManager
Create our keystore in the desired place
Fill the fields for our key
Done! We have generated our Key locate it in your Explorer
4.-Obtaining the number of SHA256
To obtain the SHA256 by console we must follow the following link
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/signing-fingerprint-0000001050071709-V5
Remember that it is also recommended that you adjust your java PATH in the Windows environment variables if your computer has this system.
5.-Finishing setup in AGC
Once we have obtained our fingerprint, place it in the corresponding section in AGC
6.- Let's download the plugin
Our AGC App has been configured now we must download the Unity plugin. Let's go to the next link and download the ZIP.
https://github.com/EvilMindDevs/hms-unity-plugin
Once the plugin is downloaded, locate it in your File Explorer, because now we must import it into Unity. go to Assets-> Import Package->CustomPackage
Once the plugin is imported we will have the following folder structure
7.-Setting the json Services
Let's download the JSON Services of our App from AGC
Open the agconnect file and replace the information downloaded from your agconnect-services.json
8.-Adding data of our App to the Plugin we have to go to the Huawei menu -> App Gallery
As said in the beggining this information will be found in your App properties on AGC
We have to set up our parameters in the following fields.
9.- Adding the Account Manager prefab to the scene.
As mentioned in the documentation we must drag the desired prefab to our scene in Unity in this case we will use Account Manager so we add it to the root of our scene
10.- Add a button to the End of Game Canvas
For this example of how to use Account HMS service We will add a UI button within the canvas that is displayed at the end of the game, the purpose of this menu will be to display the authentication to Huawei.
11.-Add necessary objects in the inspector
12.-Creating an Auth class to manage the login.
Within the game scripts I have created a class called AuthLogin where we will add the following code. This code will be necessary to call the AccountManager object. Don't forget to add it to the Button object too. As shown in the image above.
Code:
using HmsPlugin;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AuthLogin : MonoBehaviour
{
public Button btnLogin;
public AccountManager myAccountManager;
// Start is called before the first frame update
void Start()
{
myAccountManager = GameObject.Find("AccountManager").GetComponent<AccountManager>();
Button btn = btnLogin.GetComponent<Button>();
btn.onClick.AddListener(TaskOnClick);
}
public void TaskOnClick()
{
if (myAccountManager)
{
myAccountManager.SignIn();
}
else
{
myAccountManager = GameObject.Find("AccountManager").GetComponent<AccountManager>();
}
}
// Update is called once per frame
void Update()
{
}
Documentation mentions that you execute the login method to start with the authentication but reviewing the class the only methods we have are Sign In and SignOut
Conclusion
With this little exercise we have learned how to implement the HMS plugin and start using HMS in Unity, I hope it helps you, the plugin also has the following Kits.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hi Everyone!
Command-line interfaces (CLIs) built in Node.js allow you to automate repetitive tasks while leveraging the vast Node.js ecosystem. And thanks to package managers like npm and yarn, these can be easily distributed and consumed across multiple platforms.
In this post I will introduce Quick Apps and a Command-line interface that i developed and published to generate Quick Apps from H5 in a different way.
What is Quick Apps?
Quick apps are a new type of installation-free app and are supported by more than 12 major Chinese mobile phone manufacturers.
Strengths of Quick Apps
Low Cost: A quick app requires only 20% of the code of an Android app and can be developed within as little as 3 days.
Native Experience: Quick apps are installation-free and can update automatically. They can offer an excellent native experience.
High Retention: Installation-free quick apps can be added to the home screen and directly used with a single touch, which helps to attract and retain more users.
Easy Access: After being seamlessly integrated into HUAWEI Ability Gallery, quick apps can be easily accessed through HUAWEI Assistant, Global Search, and more.
How to develop your quick app?
Sign in to AppGallery Connect and create a quick app.
Apply for services that you are ready to integrate into the quick app.
Download and install Huawei Quick App IDE.
Develop your quick app according to relevant requirements.
Submit the RPK and wait for review.
Converting an H5 App into a Quick App
Quick apps are different from HTML5 apps. A quick app has its own development standards and runs based on the Quick App Center. However, quick apps support HTML5 web page loading through the web component. In this way, HTML5 apps can be converted into quick apps quickly. After a quick app generation and release in HUAWEI AppGallery, users can directly open the app and have the same experience as using the original HTML5 app.
Conversion can be handled in Huawei Quick App IDE or online.
To learn more about online conversion, check out this article.
To learn more about conversion by IDE, check out this article.
H5 to QuickApp CLI
Prerequisites: npx which comes with npm 5.2+ and higher.
To create a single QuickApp:
Code:
npm install -g @onurkenis/create-quick-app # install globally once
create-quick-app # run from anywhere
npx @onurkenis/create-quick-app # run via npx without installing
Batch application creation from JSON:
Code:
npm install -g @onurkenis/create-quick-app # install globally once
create-quick-app --fromJson=path_of_json # run from anywhere
npx @onurkenis/create-quick-app --fromJson=path_of_json # run via npx without installing
JSON format for Batch Creation:
Code:
{
"projects": [
{
"appName": "TestApp1",
"packageName": "com.onurkenis.one",
"url": "https://github.com/onurkenis/create-quick-app",
"icon": "C:/Pictures/optional_icon.jpg"
},
{
"appName": "TestApp2",
"packageName": "com.onurkenis.two",
"url": "https://github.com/onurkenis/create-quick-app"
},
{
"appName": "TestApp3",
"packageName": "com.onurkenis.three",
"url": "https://github.com/onurkenis/create-quick-app"
}
]
}
Options:
All options can be empty when running the create-quick-app. Missing fields will be asked respectively. Batch creation is only available in-line.
Code:
const args = {
'--appName': String, // name of your application
'--packageName': String, // package name of your application
'--url': String, // url to render in app
'--icon': String, // path of app icon. default icon will be used if this field is empty
'--fromJson': String, // Path of JSON file for batch creation
};
Code:
npx @onurkenis/create-quick-app
--appName="My App"
--packageName=com.onurkenis.myApp
--url=https://github.com/onurkenis/create-quick-app
--icon=./icon.png
RPK Generation:
To get rpk file, do followings and check
Code:
PROJECT_PATH/dist
folder.
Code:
cd PROJECT_PATH
npm install
npm run release
References
You can check out the source code and npm package from following links:
https://github.com/onurkenis/create-quick-app
https://www.npmjs.com/package/@onurkenis/create-quick-app
Quick Apps Official Page:
https://developer.huawei.com/consumer/en/huawei-quickApp
Scenarios:
https://developer.huawei.com/consumer/en/doc/development/quickApp-Guides/quickapp-scenario
Converting an H5 App into a Quick App:
https://developer.huawei.com/consumer/en/doc/development/quickApp-Guides/quickapp-h5-to-quickapp
Related Links
Thanks to Onur Kenis for this article.
Original post: https://medium.com/huawei-developers/h5-to-quickapp-cli-create-projects-with-one-line-28c94bf5bcae
Introduction
HMS Video Kit allow us to play video by using a URL or multiple URLs that contain an address of a video. The latest version of this kit allow us to playback videos but in the later version it will support both editing and hosting of videos.
This service helps us to build a superb video experience for our app users.
Use Cases
1) The service can be used in a news app that contains small videos of the reported incident.
2) The service can be used as a video editing app.
3) The service can be used as a promotion video in your application.
4) The service can be used as an educational video related application.
In this article we will be working on one of the use case and that is education video related application. For that we need two major players in any software development and that is server and client.
Demo
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Server Side (Node Server)
Prerequisite
1) We must have latest version of Node installed.
2) We must have latest version of Visual Studio Code installed.
3) Laptop/desktop and Huawei mobile device must share same Wi-Fi connection.
Tool’s required
1) Express js is a Node js web application server framework, designed for building single-page, multi-page, and hybrid web applications. It is the de facto standard server framework for node.js.
We don't have to repeat same code over and over again using Express js. Node.js is a low-level I/O mechanism which has an HTTP module. If you just use an HTTP module, a lot of work like parsing the payload, cookies, storing sessions, selecting the right route pattern based on regular expressions will have to be re-implemented. With Express.js, it is just there for us to use.
Express.js basically helps us manage everything, from routes, to handling requests and views.
2) Request module is by far the most popular (non-standard) Node package for making HTTP requests. Actually, it is really just a wrapper around Node's built in http module, so we can achieve all of the same functionality on your own with http, but request just makes it a whole lot easier.
Code:
const request = require('request');
request(' https://developer.huawei.com/consumer/en/', function(err, res, body) {
console.log(body);
});
The code above submits an HTTP GET request to developer.huawei.com and then prints the returned HTML to the screen. This type of request works for any HTTP endpoint, whether it returns HTML, JSON, an image, or just about anything else.The first argument to request can either be a URL string, or an object of options. Here are some of the more common options you'll encounter in our application:
a) url: The destination URL of the HTTP request
b) method: The HTTP method to be used (GET, POST, DELETE, etc.)
c) headers: An object of HTTP headers (key-value) to be set in the request
d) form: An object containing key-value form data
Creating Project
First we need to find a space in our machine and create a folder. We can name the folder whatever we want. Open Visual Studio Code, navigate to particular folder location which we created using cd command in the terminal of VS code. Run the below command to create package.json file.
Code:
npm init
Answer the questions presented, and you will end up with a package.json that looks like this:
Code:
{
"name": "android-node-server",
"version": "1.0.0",
"description": "It is a server for HMS Push Notification Kit",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sanghati",
"license": "ISC"
}
We need to run the above command when we start a new project. Also whatever tools we install in this project, a dependency will be added in the package.json file and we use the below command to install our dependencies in node_modules folder.
Code:
npm install
We may need to run this every time we manually add a dependency to our package.json file.
Install Express
We run the below command to install Express js in our project.
Code:
npm install express –save
--save, will ensure to add express dependency to our package.json file.
Create app.js file
To create app.js file using VS code terminal we need touch. Touch command creates an empty file if it doesn’t exist. Run the below command to create app.js file.
Code:
npm install -g touch-cli
touch app.js
More details, you can visit https://forums.developer.huawei.com/forumPortal/en/topic/0204400319008240095
Overview
Android App Bundle (.aab) is a new publishing format introduced by Android. A few out of many benefits of using app bundle are dynamic ability, automatic multi-APK distribution, smaller APK size and dynamic feature modules.
AppGallery uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app. For example, a user should not get x86 libs if the device architecture is armeabi. Also, users should not get other resources like strings and drawables they are not using.
Introduction
Dynamic Ability modules allow you to separate certain features and resources from the base module of your app.
HUAWEI AppGallery provides a sub-app bundle that adapts only to the user's device type, thereby reducing network data and device storage space, with which the same service functions can be provided.
Dynamic Ability initial app download is smaller for all users. Developers can customize how and when that feature is downloaded onto devices running Android 5.0 (API level 21) or higher. It gives freedom to integrate large 3rd party libraries (< 150MB) on demand.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Dynamic Ability with split APKs
Split APKs are very similar to regular APKs. They can include compiled DEX bytecode, resources, and an Android manifest. However, the Android platform is able to treat multiple installed split APKs as a single app. The benefit of split APKs is to break up a monolithic APK into smaller, discrete packages that are installed on a user’s device as required.
Base APK: This APK contains code and resources that all other split APKs can access and provides the basic functionality for your app.
Configuration APKs: Each of these APKs includes native libraries and resources for a specific screen density, CPU architecture, or language. That is, they are downloaded and installed along with the APK they provide code and resources for.
Dynamic Feature APKs: Each of these APKs contains code and resources for a feature of your app that is not required when your app is first installed. That is, using the Dynamic ability SDK, dynamic APKs may be installed on-demand after the base APK is installed on the device to provide additional functionality to the user.
Prerequisite
1. A computer with Android Studio installed and able to access the Internet
2. Huawei phone
3. Java JDK (1.8 or later)
4. Android API (level 21 or higher)
5. Android Studio (3.2 or later)
Integration process
1. Open the build.gradle file in the root directory of your Android Studio project.
Code:
dependencies {
implementation 'com.huawei.hms:dynamicability:1.0.11.302' ...
}
2. Add the following lines in the build.gradle file in Base App. In the file, the Android closure contains the following configuration.
Code:
android {
// Ignore irrelevant configurations.
// Base App is associated with Dynamic Feature Module.
dynamicFeatures = [":demofeature"]
}
3. Add the following lines in the build.gradle file in Dynamic Feature Module. In the file, the dependencies closure contains the following configuration.
Code:
dependencies {
// Ignore irrelevant configurations.
// The module depends on Base App.
implementation project(':app')
}
3. Add the following lines in the build.gradle file in Dynamic Feature Module. In the file, the dependencies closure contains the following configuration.
Code:
dependencies {
// Ignore irrelevant configurations.
// The module depends on Base App.
implementation project(':app')
}
4. Set Application for Base App in the project, override the attachBaseContext() method, and add the SDK startup code.
Code:
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// Start the Dynamic Ability SDK.
FeatureCompat.install(base);
}
}
5. Add the following configuration to the activity in the feature.
Code:
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
FeatureCompat.install(newBase);
}
More details, you can visit https://forums.developer.huawei.com/forumPortal/en/topic/0204411536738730208