我使用 android studio 2022.2.1 flamingo JDK 17 Gradle 8.7
蓝牙和 NFC 已关闭,但我发现名为蓝牙应用程序和 NFC 服务应用程序的系统应用程序有时会运行,即使我手动停止应用程序进程也是如此。
如何使用 java 和 flamingo 停止 Android 12 系统应用程序中的蓝牙应用程序进程和 nfc 服务进程或其他名称的进程,并安排在后台运行以每 10 秒停止这些应用程序进程?
我是 Android 编程新手,Mainactivity.java 在编译前在代码下划线处显示缺少权限
此视图不受限制。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
我不确定您为什么要尝试停止这些服务,因为它们被设计为一直运行并自动重新启动。
还有
<uses-permission>
XML 元素不属于 XML 视图文件,它们仅属于“AndroidManifest.xml”文件。
所以你把它们用在了错误的地方。