Skip to content

Add snippets for Engage SDK Skill#914

Merged
yrezgui merged 6 commits into
mainfrom
engagesdk
May 12, 2026
Merged

Add snippets for Engage SDK Skill#914
yrezgui merged 6 commits into
mainfrom
engagesdk

Conversation

@huewu
Copy link
Copy Markdown
Contributor

@huewu huewu commented May 12, 2026

  • EngageWorker and EngagePublisher for background data publishing using WorkManager
  • EngageBroadcastReceiver for handling SDK publish intents
  • ClusterRequestFactory and ItemToEntityConverter for data mapping
  • Constants for holding common values like attempt counts, publish types etc.
  • Update AndroidManifest.xml with required permissions and receiver configuration
  • Add engage-core dependency and associated constants

* `EngageWorker` and `EngagePublisher` for background data publishing using WorkManager
* `EngageBroadcastReceiver` for handling SDK publish intents
* `ClusterRequestFactory` and `ItemToEntityConverter` for data mapping
* `Constants` for holding common values like attempt counts, publish types etc.
* Update `AndroidManifest.xml` with required permissions and receiver configuration
* Add `engage-core` dependency and associated constants
@huewu huewu requested review from kkuan2011 and yrezgui as code owners May 12, 2026 06:17
@snippet-bot
Copy link
Copy Markdown

snippet-bot Bot commented May 12, 2026

Here is the summary of changes.

You are about to add 10 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the Google Engage SDK, adding the required dependencies, manifest configurations, and a WorkManager-based publishing system. It includes a CoroutineWorker for handling data synchronization and a BroadcastReceiver for responding to Engage intents. Review feedback highlights several critical improvements: fixing an unsafe cast and potential compilation error in the exception handling logic, preventing worker crashes by handling unknown error codes gracefully, optimizing broadcast receiver registration by combining intent filters, and ensuring internationalization support by using the system locale instead of a hardcoded string.

Comment thread misc/src/main/java/com/example/snippets/engage/EngageWorker.kt
Comment thread misc/src/main/java/com/example/snippets/engage/EngageWorker.kt Outdated
Comment thread misc/src/main/java/com/example/snippets/engage/ClusterRequestFactory.kt Outdated
Comment thread misc/src/main/java/com/example/snippets/engage/EngageBroadcastReceiver.kt Outdated
huewu and others added 4 commits May 12, 2026 15:19
* Update `EngageWorker` to use safe casts when handling `AppEngageException`.
* Add a null check and default failure result in `handlePublishException`.
* Fix a mismatched snippet tag in `ClusterRequestFactory`.
Comment thread gradle/libs.versions.toml
androidx-core-telecom = { group = "androidx.core", name = "core-telecom", version.ref = "androidx-core-telecom" }
androidx-media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "media3Session" }
play-services-fitness = { group = "com.google.android.gms", name = "play-services-fitness", version.ref = "playServicesFitness" }
engage-core = { group = "com.google.android.engage", name = "engage-core", version.ref = "engageCore" }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add for engage-tv ? Was it added to patterns.md ? @huewu

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We don't touch dependency part in pattern.md.

All the necessary dependecies (contents under ## Dependency Specifications (libs.versions.toml) section) will be there . This is only for making code snippet compilable.

* Update `EngageWorker` to return false instead of throwing an exception on unknown error codes.
* Consolidate `EngageBroadcastReceiver` registration using a single `IntentFilter` for all actions.
* Update `AccountProfile` to use the system default locale instead of a hardcoded value.
@yrezgui yrezgui merged commit 8e8c505 into main May 12, 2026
6 checks passed
@yrezgui yrezgui deleted the engagesdk branch May 12, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants