If you are using HUAWEI DevEco Studio, you can integrate the HMS Core SDK via the Maven repository. Before you start developing an app, integrate the HMS Core SDK into your HUAWEI DevEco Studio project.
If you have enabled certain services in AppGallery Connect, add the agconnect-services.json file to your app.


If you have made any changes on the Project settings page, such as setting the data processing location or enabling or disabling APIs, you need to download the latest agconnect-services.json file and replace the existing one.
buildscript {
dependencies {
classpath 'com.huawei.ohos:hap:2.4.4.2'
// Add a dependency on the AppGallery Connect service.
classpath 'com.huawei.agconnect:agcp-harmony:1.3.0.300'
}
} 
dependencies {
implementation 'com.huawei.hms:push-ohos:5.2.0.306'
} You need to register service under module in the entry/src/main/config.json file to obtain a push token. service inherits from the HmsMessageService class and implements the methods in the class. The following uses the service with the DemoHmsMessageServiceAbility class name as an example. You can change the class name as needed.
{
"module": {
"abilities": [
{
...
"skills": [
{
"actions": [
"com.huawei.push.action.MESSAGING_EVENT"
]
}
],
"name": ".DemoHmsMessageServiceAbility",
"icon": "$media:icon",
"description": "$string:demohmsmessageserviceability_description",
"type": "service",
"visible": false,
"permissions": []
}
]
}
}