Android Studio: HMS Console
Jump to navigation
Jump to search
HMS Console penting untuk mengaktifkan HMS Kit. URL di,
Langkah membuat Aplikasi Menggunakan HMS Kit
- Login Huawei Developer > Console
- Klik "Distribution and promotion" di atas AppGallery Connect
- Klik "AppGallery Connect"
- Klik "My Projects"
- Klik "Add project"
- New project > Name : nama-project-yang-kita-buat (misal ITTS HMS Kit Test) > OK
- Klik "Add app"
- Isi:
Platform: Android Device: Mobile Phone App name: ITTS HMS Kit Test Package name: nama.app.anda (contoh itts.onno.hms.kit.test) App category: App Default language: Indonesian
- Klik OK
- Lakukan hal yang sama PERSIS di Android Studio, pastikan sama di
App name Package name
Setup SDK
Download agconnect-services.json
a) Downloaded the agconnect-services.json file. b) Switch Android Studio to the Project view. c) Copy the agconnect-services.json file to the app root directory.
- Copy ke folder src (via File Explorer di OS Ubuntu)
~/AndroidStudioProjects/ITTSHMSKitTest/app/src/
Setup gradle
Edit Projects > Android > Gradle Scripts > build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { dependencies { classpath "com.android.tools.build:gradle:7.1.2" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.huawei.agconnect:agcp:1.6.0.300' // tambahkan } } plugins { id 'com.android.application' version '7.1.2' apply false id 'com.android.library' version '7.1.2' apply false } task clean(type: Delete) { delete rootProject.buildDir }
Edit Projects > Android > Gradle Scripts > settings.gradle
pluginManagement { repositories { gradlePluginPortal() google() mavenCentral() maven {url 'https://developer.huawei.com/repo/'} // tambahkan } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven {url 'https://developer.huawei.com/repo/'} // tambahkan } } rootProject.name = "My Application" include ':app'
Adding Build Dependencies
Edit Projects > Android > Gradle Scripts > build.gradle
plugins { id 'com.android.application' id 'com.huawei.agconnect' // tambahkan } android { ... } dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation 'com.huawei.hms:hwid:6.4.0.300' // tambahkan }
Sync
Setelah
- Restart
- Sync
Kemungkinan akan ada notifikasi di Event Log untuk
- Plugin updates: HMS Toolkit, Huawei Cloud Toolkit
Optional Tambahkan Plugin
Selain agconnect-core, kita perlu menambahkan implementation untuk HMS kit yang kita gunakan seperti daftar berikut,
Service Configuration Auth Service implementation 'com.huawei.agconnect:agconnect-auth:1.6.4.300' Remote Configuration implementation 'com.huawei.agconnect:agconnect-remoteconfig:1.6.4.300' Cloud Functions implementation 'com.huawei.agconnect:agconnect-function:1.6.4.300' Cloud DB implementation 'com.huawei.agconnect:agconnect-cloud-database:1.5.0.300' App Linking implementation 'com.huawei.agconnect:agconnect-applinking:1.6.4.300' Crash implementation 'com.huawei.agconnect:agconnect-crash:1.6.4.300' APM implementation 'com.huawei.agconnect:agconnect-apms:1.5.2.309' Cloud Storage implementation "com.huawei.agconnect:agconnect-storage:1.4.0.100" App Messaging implementation 'com.huawei.agconnect:agconnect-appmessaging:1.6.4.300'
Detail lainnya bisa di lihat di https://developer.huawei.com/consumer/en/hms
Configuring Metadata
Tambahkan di application code element di AndroidManifest.xml
<application ...> <meta-data android:name="com.huawei.hms.client.channel.androidMarket" android:value="false" /> ... </application>
Synchronizing the Project
- Klik Sync