Integration
To enable androidX add next parameters to yours gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
Copy google-services.json file to app folder.
For that file ask your manager.
Copy agconnect-services.json file to app folder.
For that file ask your manager.
Check if you have the necessary settings in the build.gradle (project level) file, if not, please add them:
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com/' }
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
classpath 'com.huawei.agconnect:agcp:1.9.1.300'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com/' }
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com/' }
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://developer.huawei.com/repo/' }
}
}
In the file build.gradle (application level) add:
apply plugin: 'com.huawei.agconnect'
android {
defaultConfig {
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
}
repositories {
google()
maven {
url 'https://artifactory101xp.jfrog.io/artifactory101xp/p101xp-android-stage/'
credentials {
username = "sdk-user"
password = "Dt!k(5JR&6"
}
}
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
maven { url 'https://maven.google.com/'}
maven { url 'https://jitpack.io' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://android-sdk.is.com/' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-v4:29.0.0'
implementation 'com.android.support:appcompat-v7:29.0.0'
implementation 'com.android.support:design:29.0.0'
implementation 'com.android.support:recyclerview-v7:29.0.0'
implementation 'com.android.support:customtabs:29.0.0'
implementation 'com.android.support:animated-vector-drawable:29.0.0'
implementation 'com.android.support:cardview-v7:29.0.0'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.platform101xp:sdk_huawei:2.XX.XX'
implementation 'com.platform101xp:advertising_huawei:2.XX.XX'
implementation 'com.platform101xp:api_huawei:2.XX.XX'
implementation 'com.platform101xp:authorization_huawei:2.XX.XX'
implementation 'com.platform101xp:base_huawei:2.XX.XX'
implementation 'com.platform101xp:billing_huawei:2.XX.XX'
implementation 'com.platform101xp:utils_huawei:2.XX.XX'
}
apply plugin: 'com.google.gms.google-services'
if add implementation 'com.platform101xp:advertising_huawei:2.XX.XX' please read Advertising
Editing AndroidManifest.xml
Also, you should edit the AndroidManifest.xml file before using the SDK.
Add the following items to your manifest:
- In <manifest> add:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- huawei -->
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
- In <application> add:
<application
...
android:allowBackup="true"
android:icon="..."
android:label="@string/app_name"
android:theme="@style/AppSDKTheme"
android:name="androidx.multidex.MultiDexApplication">
...
<activity
android:name="com.platform101xp.authorize.AuthorizeActivity"
android:exported="true" />
<activity
android:name="com.platform101xp.authorize.social_networks.activity.InviteActivity"
android:exported="true" />
<activity
android:name="com.platform101xp.authorize.dialogs.web_dialogs.WebFragmentActivity"
android:exported="true" />
Then, add the values for the next parameters.
Please, ask your manager for those values.
<meta-data android:name="com.huawei.hms.client.appid"
android:value="appid=$your_app_id" />
<meta-data android:name="com.huawei.hms.client.cpid"
android:value="cpid=$your_cp_id" />
Gradle settings for SDK
Please make sure your gradle version is >=7, compileSdkVersion >= 33, buildToolsVersion >= 33, minSdkVersion >= 21. If your application contains kotlin gradle plugin please set his version >= 1.8.*
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21"
...
}
}
android {
...
compileSdkVersion 33
buildToolsVersion '33.0.0'
...
defaultConfig {
minSdkVersion 21
...
}