android / performance-samples

Samples to show APIs and best practices in Performance on Android

Home Page:https://d.android.com/topic/performance/overview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to allow runtime location permission during macro benchmark startup test

yadavraju opened this issue · comments

You can use GrantPermissionRule from androidx.test:rules:*

For example:

@get:Rule
val grantPermissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION)

@get:Rule
val benchmarkRule = MacrobenchmarkRule()

@Test
fun benchmarkStartup() {
  // ...
}