问题标签 [android-9.0-pie]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
6003 浏览

android - Android BiometricPrompt 兼容库

嗨,正如这篇文章中提到的,有适用于支持 Android O 及更低版本的设备的BiometricPrompt API,但我无法找到BiometricPrompt Compat Library(如图中提到的那样),有没有人能帮我指出支持库在哪里,任何链接或指南?在此处输入图像描述

0 投票
1 回答
406 浏览

android - getAppStandbyBucket 需要未知权限

当我尝试使用 UsageStatsManager.getAppStandbyBucket 获取新的 Android 8(或 P)应用程序备用存储桶时,我收到此错误,为应用程序提供了所有可能的权限,但仍然崩溃:

java.lang.SecurityException: MATCH_ANY_USER 标志需要 com.android.server.pm.PackageManagerService.getPackageUid:4959 com.android.server.pm.PackageManagerService$PackageManagerInternalImpl.getPackageUid:25142 com.android.server.usage.UsageStatsService$ 的 INTERACT_ACROSS_USERS 权限BinderService.getAppStandbyBucket:932 android.app.usage.IUsageStatsManager$Stub.onTransact:274 android.os.Binder.execTransact:731:用户 10228 和当前进程都没有 android.permission.INTERACT_ACROSS_USERS。

0 投票
2 回答
4962 浏览

android - Android P Beta - AlarmManager 通知不起作用

我正在 Android P beta 版本 4 上测试我的应用程序。我的应用程序的targetSdkVersion 是 27

已观察到警报管理器通知未按预期工作。我正在使用下面的代码来设置通知 -

I tested the same logic on Android 8.0 but it's working fine. In Android 9.0, notifications are working but sometimes they did not work at all. Also, if they work they are not exact and takes too much time and this happens even if the application is in foreground.

The logic is, I've the repeating reminders which are set on specific time and those should repeat them-self on daily basis at the specified time. Also these are high priority reminders and should land at exact time so I'm using setExact and once the notification is received it's being display and new alarm for the next week of the same day is set.

我检查了 Android P API 文档,但找不到任何影响AlarmManager和 Notifications 工作的链接。我觉得唯一导致问题的是Android P 中的电源管理和优先级存储桶。但是,即使应用程序在前台,通知也无法正常工作。

我在这里缺少的任何东西。任何帮助深表感谢。

0 投票
1 回答
1833 浏览

android - 如何获取 DisplayCutoutCompat 的实例

我正在寻找一种使用方法,DisplayCutoutCompat因为我想知道设备凹槽的高度来移动布局。

该文档并没有真正指出如何在 onCreate 方法中获取实例。

0 投票
0 回答
338 浏览

android - android.view.InflateException 仅在 android 8.1 上发生

尝试将带有文本视图的片段附加到运行 Android 8.1 的像素上的活动中时,出现以下崩溃。我已经在运行 Android 9.0 的 Pixel 2、运行 Android 7.0 的 S6 和运行 Android 6.0 的 S5 上对此进行了测试,并且没有发生崩溃。

碰撞:

片段 XML:

片段类:

摇篮依赖:

这可能是由于我做错了什么引起的,还是我正在使用的某个库有问题。我要加载的文本是一本超过 500 行长的书的片段。

-谢谢

0 投票
0 回答
2678 浏览

android - 使用 API 28 在 Android P 中使用外部 USB 摄像头

今天,Android P 发布了。我想知道是否有任何使用 API 28INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL提供的示例 来让外部 USB 网络摄像头与摄像头应用程序一起使用。

有些人之前尝试过类似的事情,例如https://play.google.com/store/apps/details?id=snapexwebcam.com&hl=en_UShttps://github.com/jwoolston/Android-Webcam,但他们似乎没有使用 Google 的外部摄像头 API 来实现这一点。

0 投票
0 回答
282 浏览

android - Android Pie:反转 ScrollView 势头

我的应用程序使用ScrollViewwith android:scaleY="-1"。在搭载 Android P 的手机中,滚动的势头现在已恢复。

这意味着在我向下滚动并释放后 - scrollView 继续向上滚动(动量)

可以在这里看到一个例子

也许它与滚动变化有关,但不清楚它们是什么

值得一提的是,相同的应用程序在旧版本的 Android 上可以正常运行

我的问题是:这是新 Android 版本中的错误吗?或者我在我的滚动视图中缺少一些滚动属性?

0 投票
2 回答
2120 浏览

android - Android P:如果用户已回复通知,`NotificationManager.cancel` 将不起作用

NotificationManager.cancel(id)如果您已经用文本回复了通知,则不再清除 Android P上的通知。

用户在 Android P 中回复通知后,有没有办法清除通知?

在此处输入图像描述


构建.gradle

AndroidManifest.xml

MainActivity.kt

NotificationActionBroadcastReceiver.kt

0 投票
3 回答
6412 浏览

android - 从 PHONE_STATE 意图操作中读取数字 android 9 不工作

我试图通过 onrecieve() 方法为清单文件中注册的以下广播接收器从 Intent Extra 中检索电话号码。

我可以成功读取除我的像素 2 设备中升级的 android pie 之外的所有版本的电话号码。根据文档,应用程序需要额外的权限才能读取电话号码,即 READ_CALL_LOG 权限和 READ_PHONE_STATE 权限,但即使在允许这些权限之后,我仍然缺少 READ_CALL_LOG 的权限,因此我无法读取电话号码。请帮我解决这个问题。

0 投票
4 回答
14554 浏览

android - 如何处理低于 28 的 android API 中的缺口(显示切口)?

Android 在 API 28 上添加了缺口支持,但是如何在运行 API 27 的设备(荣耀 10、华为 P20 等)上处理它?

我试图使用DisplayCutoutCompat但我无法创建它的实例,因为文档并没有真正指出如何创建一个。

如何创建构造函数参数值:Rect safeInsetsList<Rect> boundingRects

我还查看了构造函数的源代码,这让我有点困惑:

这将始终在运行API < 28的设备上返回 null 。先感谢您。