Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Initializing the SDK Synchronously

Updated on 2024-07-30 GMT+08:00

Init

Initializing the SDK synchronously

1
HWMSdk.init(Application,OpenSDKConfig)

API Description

This API is used to initialize the SDK and prepare the environment. It must be called prior to other APIs. It needs to be called only once. You are advised to call this API in onCreate of the application. Call this API as early as possible so that the SDK can obtain the current activity and jump to a specified page by listening to the activity lifecycle.

Precautions

1. Initializing the API takes about 1 to 2 seconds. If you have requirements on the initialization speed, use the asynchronous initialization API.

2. Pass the correct Application and OpenSDKConfig objects.

3. If you do not want to call this API in onCreate of the application, set openSDKConfig.setInitOnAppStart(false).

Method Definition

1
2
3
4
5
6
 /**
     * Initializes the SDK.
     * @param application Indicates the application object.
     * @param sdkConfig Indicates the SDK configuration object.
     */
void init(@NonNull Application application, OpenSDKConfig sdkConfig);

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

application

Yes

Application

Application object.

sdkConfig

Yes

OpenSDKConfig

SDK configuration object.

Table 2 Initialization information OpenSDKConfig

Parameter

Mandatory

Type

Description

appId

Yes

String

App ID. You need to request an app ID. For details, see Introduction to App ID Authentication in Developer Guide.

serverAddress

No

String

Server address.

serverPort

No

String

Server port.

needConfChat

No

Boolean

Whether the in-meeting chat function is required.

logKeepDays

No

Integer

Log storage duration. Valid value range is 3–30. The default value is 0. 0 indicates that logs are not deleted by day.

Note: 1 and 2 will be converted to 3, and the values greater than 30 will be converted to 30.

isDisableIncomingNotification

No

Boolean

Whether to disable automatic display of the notification when an incoming call is received.

isSupportMultiAppLogin

No

Boolean

Whether to support login to multiple applications on the same device.

Sample Code

OpenSDKConfig sdkConfig = new OpenSDKConfig(this)        
         .setAppId(getAppId()) 
// Request an app ID. For details, see Requesting an App ID.
HWMSdk.init(this,sdkConfig);

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback