【发布时间】:2020-10-04 04:31:23
【问题描述】:
我在 IntelliJ 中使用 Kotlin,是的,我已经在 Java 中尝试过,结果更糟。它只给了我 3 个应用程序:Google Play、Go Time(应用程序目前正在运行)和 Play 商店。
我正在尝试获取设备上的完整应用列表。当我尝试使用意图过滤器时,我只得到了斜体中提到的 3 个应用程序。这是我正在使用的功能:
private fun getInstalledAppList():List<AppObject>
{
val list: ArrayList<AppObject> = arrayListOf()
val untreatedAppList = packageManager.getInstalledApplications(0)
for (untreatedApp in untreatedAppList)
{
if ((untreatedApp.flags and applicationInfo.flags) !== 0)
{
var appName: CharSequence = untreatedApp.loadLabel(packageManager)
var appPackageName = untreatedApp.packageName
var appImage = untreatedApp.loadUnbadgedIcon(packageManager)
var app = AppObject(appPackageName, appName, appImage)
println(appName)
if (!list.contains(app)) {
list.add(app)
}
}
}
return list
}
我在运行窗口中得到这个结果:
I/System.out: Tethering
I/System.out: Android Services Library
I/System.out: Phone and Messaging Storage
I/System.out: Dynamic System Updates
Cell Broadcast Service
I/System.out: Calendar Storage
com.android.providers.media
I/System.out: External Storage
I/System.out: Companion Device Manager
MmsService
I/System.out: Download Manager
Circular
I/System.out: Media Storage
I/System.out: Time Zone Updater
com.android.systemui.plugin.globalactions.wallet
I/System.out: Downloads
I/System.out: Google Play Store
I/System.out: PacProcessor
I/System.out: Sim App Dialog
I/System.out: Certificate Installer
I/System.out: com.android.carrierconfig
I/System.out: Android System
I/System.out: Android R Easter Egg
I/System.out: MTP Host
I/System.out: Nfc Service
com.android.ons
I/System.out: SIM Toolkit
com.android.backupconfirm
I/System.out: Permission controller
com.android.emulator.radio.config
I/System.out: Settings Storage
com.android.sharedstoragebackup
I/System.out: SecureElementApplication
I/System.out: Input Devices
I/System.out: Emu01 display cutout
I/System.out: Markup
com.android.cellbroadcastreceiver
I/System.out: Network manager
I/System.out: Call Management
Rounded
I/System.out: Key Chain
I/System.out: com.android.service.ims.RcsServiceApp
I/System.out: Package installer
I/System.out: Google Play services
I/System.out: Google Services Framework
I/System.out: com.google.android.overlay.permissioncontroller
com.google.android.overlay.emulatorconfig
I/System.out: Call Log Backup/Restore
com.android.localtransport
I/System.out: CarrierDefaultApp
I/System.out: ProxyHandler
I/System.out: Work Setup
I/System.out: Sounds
I/System.out: Emulator Multi Display Provider
I/System.out: Presence
I/System.out: Live Wallpaper Picker
I/System.out: com.google.android.sdksetup
com.android.server.NetworkPermissionConfig
I/System.out: Go Time
I/System.out: Settings
I/System.out: Carrier Provisioning Service
VpnDialogs
I/System.out: Phone Services
I/System.out: Shell
Filled
I/System.out: com.android.wallpaperbackup
I/System.out: Blocked Numbers Storage
I/System.out: User Dictionary
I/System.out: Emergency information
I/System.out: Fused Location
I/System.out: System UI
I/System.out: Bluetooth MIDI Service
I/System.out: System Tracing
I/System.out: Bluetooth
I/System.out: Contacts Storage
现在这会返回一堆系统应用程序,这当然不是首选,但它仍然没有显示在本机应用程序抽屉中显示的用户应用程序,例如 YouTube 或时钟。 Native App Drawer 我错过了什么?我认为问题可能比我的代码更深,因为我已经看到像我这样的代码与许多其他人一起工作得很好,而且他们似乎根本没有遇到我的问题。
请帮忙,过去两天我一直被困在这个问题上。谢谢,非常感谢您的帮助!
【问题讨论】:
标签: android api android-studio kotlin intellij-idea