Skip to content

Conversation

@asolovay
Copy link
Contributor

@asolovay asolovay commented Aug 7, 2025

Starting with the code snippets to add and release a wake lock, we can add other snippets later.

Used by docs in:

https://developer.android.com/develop/background-work/background-tasks/awake/wakelock/

The actual snippets used on the DAC pages are bracketed by the [START ...] and [END ...] comments; everything else is just scaffolding to get the snippet to compile.

Starting with the code snippets to add and release a wake lock, we can add other snippets later.

Used by docs in:

https://developer.android.com/develop/background-work/background-tasks/awake/wakelock/
@asolovay asolovay self-assigned this Aug 7, 2025
@asolovay asolovay marked this pull request as ready for review August 7, 2025 21:39
@snippet-bot
Copy link

snippet-bot bot commented Aug 7, 2025

Here is the summary of changes.

You are about to add 4 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

@asolovay asolovay requested a review from AliceYuan August 7, 2025 21:39
asolovay and others added 2 commits August 8, 2025 16:19
One of the region tags was misnamed (had the _kotlin suffix
instead of _java).
Copy link

@AliceYuan AliceYuan left a comment

Choose a reason for hiding this comment

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

lgtm!

}

// [START android_backgroundwork_wakelock_release_java]
void doSomethingAndRelease() throws MyException {

Choose a reason for hiding this comment

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

what if it just throws Exception instead? I'm not sure if we need the custom exception here

@asolovay asolovay merged commit 79a26f9 into main Aug 12, 2025
5 checks passed
@asolovay asolovay deleted the wakelock_snippets branch August 13, 2025 18:13
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