Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions examples/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Two flavors are declared on the `default` dimension:

| Flavor | Use case |
|--------|----------|
| `gms` | Google Play Services / FCM — applies the `com.google.gms.google-services` plugin and pulls `play-services-location`. |
| `gms` | Google Play Services / FCM — pulls `play-services-location`. OneSignal initializes its own Firebase app, so no Google Services plugin or `google-services.json` is needed. |
| `huawei` | Huawei HMS — applies `com.huawei.agconnect`, excludes the GMS transitive deps from the OneSignal artifact, and pulls `com.huawei.hms:push` + `com.huawei.hms:location`. |

The plugin (`com.google.gms.google-services` vs `com.huawei.agconnect`) is selected at configuration time by inspecting `gradle.startParameter.taskRequests` so a clean `./gradlew tasks` doesn't require both Google and Huawei configuration files.
The Huawei plugin is selected at configuration time by inspecting `gradle.startParameter.taskRequests` so a clean `./gradlew tasks` doesn't require Huawei configuration.

### `build.gradle.kts` essentials

Expand Down Expand Up @@ -226,12 +226,11 @@ The `vine_boom.wav` file from [`sdk-shared/assets`](https://github.com/OneSignal

### Service config files

The shared default `applicationId` is `com.onesignal.example`. Both service configs must agree:
The shared default `applicationId` is `com.onesignal.example`.

- `app/google-services.json` → `package_name = "com.onesignal.example"` for the `gms` flavor.
- `app/agconnect-services.json` → every `package_name` entry set to `com.onesignal.example` for the `huawei` flavor.

If the package changes you must regenerate these from the Firebase / Huawei AppGallery consoles.
If the package changes you must regenerate this file from the Huawei AppGallery console.

### Huawei flavor

Expand All @@ -257,7 +256,6 @@ examples/
└── app/
├── build.gradle.kts # namespace = com.onesignal.example, gms/huawei flavors
├── proguard-rules.pro
├── google-services.json # package_name = com.onesignal.example
├── agconnect-services.json # package_name = com.onesignal.example
└── src/
├── main/
Expand Down
1 change: 0 additions & 1 deletion examples/demo/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ When building from `OneSignalSDK/`, the `SDK_VERSION` property is **required** a

| Problem | Fix |
|---------|-----|
| `google-services.json` error | Make sure the `gms` variant is selected. The file is already checked in. |
| Push not received on emulator | Use a device with Google Play Services. Some emulator images lack FCM support. |
| `SDK_VERSION is not defined` | You're building from `OneSignalSDK/`. Pass `-PSDK_VERSION=X.Y.Z`. |
| Gradle sync fails on Huawei deps | Switch to `gmsDebug` unless you specifically need HMS testing. |
6 changes: 2 additions & 4 deletions examples/demo/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ fun demoOverride(key: String): String? {
return demoLocalProperties.getProperty(key)?.trim()?.takeIf { it.isNotEmpty() }
}

// Apply GMS or Huawei plugin based on build variant
// Apply the Huawei plugin only for Huawei build variants.
// Check at configuration time, not when task graph is ready
val taskRequests = gradle.startParameter.taskRequests.toString().lowercase()
if (taskRequests.contains("gms")) {
apply(plugin = "com.google.gms.google-services")
} else if (taskRequests.contains("huawei")) {
if (taskRequests.contains("huawei")) {
apply(plugin = "com.huawei.agconnect")
}

Expand Down
30 changes: 0 additions & 30 deletions examples/demo/app/google-services.json

This file was deleted.

1 change: 0 additions & 1 deletion examples/demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {
dependencies {
classpath("com.android.tools.build:gradle:8.8.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.google.gms:google-services:4.3.10")
classpath("com.huawei.agconnect:agcp:1.9.1.304")
}
}
Expand Down
Loading