- minSdkVersion: 21
- configured GMS or HMS in project
- Add SDK dependency to Your project
// /build.gradle
allprojects {
repositories {
// local repo
mavenLocal()
// or
// remote repo
maven {
url 'https://gitlab.goodylabs.com/api/v4/projects/297/packages/maven'
name "PPGo"
credentials(HttpHeaderCredentials) {
name = 'Deploy-Token'
value = GITLAB_PPGO_REPO_TOKEN
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
// /app/build.gradle
dependencies {
implementation 'com.pushpushgo:sdk:1.0.1'
// GMS
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-messaging'
// HMS
implementation 'com.huawei.agconnect:agconnect-core:1.5.1.200'
implementation 'com.huawei.hms:push:5.1.1.301'
}- Add to Your AndroidManifest.xml:
<meta-data
android:name="com.pushpushgo.apikey"
android:value="{apiKey}" />
<meta-data
android:name="com.pushpushgo.projectId"
android:value="{projectId}" />- Add to Your Application.onCreate():
PushPushGo.getInstance(applicationContext);- Configuration
- Change default notification color: override
@color/pushpushgo_notification_color_default - Change default notification channel id: override
@string/pushpushgo_notification_default_channel_id - Change default notification channel name: override
@string/pushpushgo_notification_default_channel_name - Change default notification icon: override
res/drawable-hdpi/ic_stat_pushpushgo_defaultres/drawable-mdpi/ic_stat_pushpushgo_defaultres/drawable-xhdpi/ic_stat_pushpushgo_defaultres/drawable-xxhdpi/ic_stat_pushpushgo_default
- Register subscriber:
PushPushGo.getInstance().registerSubscriber();- Unregister:
PushPushGo.getInstance().unregisterSubscriber();- Send beacon:
PushPushGo.getInstance().createBeacon()
.set("see_invoice", true)
.setCustomId("SEEI")
.appendTag("demo")
.appendTag("mobile", "platform")
.send();To maven local repository:
$ ./gradlew :library:publishDebugPublicationToMavenLocal // debug
$ ./gradlew :library:publishReleasePublicationToMavenLocal // release
$ ./gradlew :library:publishToMavenLocal // bothTo maven remote repository:
$ export GITLAB_PRIVATE_TOKEN=<token>
$ ./gradlew :library:publishDebugPublicationToPPGoRepository // debug
$ ./gradlew :library:publishReleasePublicationToPPGoRepository // release
$ ./gradlew :library:publishAllPublicationsToPPGoRepository // bothRun tests in library module:
$ ./gradlew :library:testDebugGenerate coverage report:
$ ./gradlew :library:jacocoTestReportHTML coverage report path: library/build/reports/jacocoTestReport/html/