android / android/codelab-android-workmanager

The `resolveActivity` doesn't work for Android 11 like this

Open
#273 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
557
Forks
242
PR merge metrics
No merged PRs in 30d

Description

The lint says It needs `@SuppressLint("QueryPermissionsNeeded")`. Also, it doesn't open the activity.
Code lab page number: https://developer.android.com/codelabs/android-workmanager#8
```
override fun onCreate(savedInstanceState: Bundle?) {
// Setup view output image file button
binding.seeFileButton.setOnClickListener {
viewModel.outputUri?.let { currentUri ->
val actionView = Intent(Intent.ACTION_VIEW, currentUri)
actionView.resolveActivity(packageManager)?.run {
startActivity(actionView)
}
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with step 8 of the Android WorkManager codelab and the onCreate snippet shown in this issue. Reproduce the lint warning and the failure to open the activity on Android 11, then verify the updated behavior and lint result against that scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.