当前位置:网站首页>Extraction system apk
Extraction system apk
2022-06-25 23:32:00 【android_ cai_ niao】
Extraction system apk
Have a company Android equipment , There is a built-in application provided by the manufacturer , There should be some prompt voice in the , I want to extract the manufacturer's application , In order to obtain voice resources in the application , So a APK Extractor, But this app doesn't list the apps I need , The system application also shows , It just doesn't show the application I need . After Baidu , Found another way to extract , I have successfully extracted what I need apk.
adopt adb Command lists Android All applications in the device
adb shell pm list packagesThe effect is as follows :

Make sure that these package names contain the package names of the applications you need , You can copy these package names to Notepad , Then press search to find out if there is a package name for your application . About how to know what the package name of the required application is , You can view the following “ Get the package name of the application running at the top ” chapter .View the saving path of the application you need , Suppose the application package you want to view is named :rst.rst3.hc_client, The operation is as follows :
adb shell pm path rst.rst3.hc_clientAfter executing this command , You can see rst.rst3.hc_client Where to save the package name application , as follows :

The storage location here is /data/app/ Under the table of contents , In this directory apk All belong to the system apk Of .obtain apk, In the last step , We have found what we need apk Where to save , Copy this path , Then the operation is as follows :
adb pull /data/app/rst.rst3.hc_client-1/base.apkThe implementation effect is as follows :

This shows that we have succeeded in apk Saved to the computer , In the above command, we did not specify the path to save , It will be saved to the current location by default , The current position in the above command line is Even, So we are Even In the directory, you can see the newly obtained file named base.apk The application of , Use compression software to compress apk decompression , Then you can get the resource file inside , Resources like audio , It's usually kept in asserts Directory , Or save it in res/raw Directory .In this way , Not only can you get common applications , Even system applications can be obtained . For example, in this example ,/data/app/ The system application is saved in the directory .
Get the package name of the application running at the top
How to know the package name of an unknown application , The method is that we can run applications with unknown package names , And let it run first . Then we can write a program to detect the package name of the application running in the front , In one of my projects , There is a service class that detects the program currently running at the top , If it is detected that the first program is not ours app when , Will put their own app Run on top , Compare rogues . Here I will directly copy the code ( Currently in Android 7.1 The last test is OK Of , In a later version, I don't know if it's OK ), The code is as follows :
/** * To the top of the stack app Check */
class StackTopAppCheckService : Service() {
private lateinit var powerManager: PowerManager
companion object {
var needMoveToTop = true
}
override fun onBind(intent: Intent): IBinder? = null
private var run = false
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (run) {
// If the check task is already running , Then return directly
return super.onStartCommand(intent, flags, startId)
}
run = true
val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
thread {
try {
while (run) {
checkStackTopApp(activityManager)
Thread.sleep(6000) // Every time 6 Every second
}
} catch (e: Exception) {
Timber.fw(e, " Check App Whether there is an exception at the top of the stack ")
}
Timber.fi("while Loop execution ends ")
// Restore variables
run = false
}
return super.onStartCommand(intent, flags, startId)
}
private fun checkStackTopApp(activityManager: ActivityManager) {
if (!isRunningForeground(activityManager)) {
// If not at the top of the stack , Move to the top of the stack
Timber.fw(" Our application is not at the top of the stack , The current stack top application is :${
getStackTopAppPackageName(activityManager)},needMoveToTop = $needMoveToTop")
if (needMoveToTop) {
// Sometimes I don't want to play all the way to the front desk , This variable will be set to false
moveToStackTop(activityManager)
}
}
}
fun getStackTopAppPackageName(activityManager: ActivityManager? = null): String {
val manager = activityManager ?: getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
return manager.runningAppProcesses?.find {
it.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
}?.processName ?: " Unknown "
}
/** Move the law enforcement instrument to the top of the stack */
@Suppress("DEPRECATION")
private fun moveToStackTop(activityManager: ActivityManager) {
activityManager.getRunningTasks(100)?.find {
it.topActivity?.packageName == App.getContext().packageName }?.let {
activityManager.moveTaskToFront(it.id, 0)
}
}
/** Determine whether the application is already at the front end : When it is already at the front end , return true; Otherwise return to false */
private fun isRunningForeground(activityManager: ActivityManager): Boolean {
return activityManager.runningAppProcesses?.any {
it.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
&& it.processName == App.getContext().applicationInfo.processName
} ?: false
}
override fun onCreate() {
super.onCreate()
Timber.fi("onCreate")
powerManager = App.getContext().powerManager
}
override fun onDestroy() {
super.onDestroy()
Timber.fi("onDestroy")
run = false
}
}
边栏推荐
- C. Planar Reflections-CodeCraft-21 and Codeforces Round #711 (Div. 2)
- . SQL database import error: / *! 40101 SET @OLD_ COLLATION_ [email protected]@COLLATION_ CONNECTION */
- konva系列教程2:绘制图形
- My C language learning process
- [Axi] interpretation of Axi protocol atomic access
- CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)
- Comp212 distributed protocol
- 牛客小白月賽52--E 分組求對數和(二分)
- 毕业旅行 | 伦敦5日游行程推荐
- Problem recording and thinking
猜你喜欢

Paper notes: multi tag learning MSWl
[email protected]@COLLATION_ CONNECTION */"/>. SQL database import error: / *! 40101 SET @OLD_ COLLATION_ [email protected]@COLLATION_ CONNECTION */

软件测试面试一直挂,面试官总是说逻辑思维混乱,怎么办?

Circuit module analysis exercise 6 (switch)

The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars

UE4_UE5结合offline voice recognition插件做语音识别功能

konva系列教程2:绘制图形

Xampp重启后,MySQL服务就启动不了。

23class introduction

#24class静态成员
随机推荐
hiberate核心API/配置文件/一级缓存详解
CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)
Use and difference between ue4\ue5 blueprint node delay and retroggable delay
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
C. Yet Another Card Deck-Educational Codeforces Round 107 (Rated for Div. 2)
Multithreaded learning 2- call control
[2023 proofreading and bidding questions] Part 1: Measurement Technology FPGA post (roughly analytical version)
Circuit module analysis exercise 6 (switch)
Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
Paper notes: multi tag learning MSWl
Live800 online customer service system: do business across time and space, starting from each interaction
【opencv450-samples】读取图像路径列表并保持比例显示
[opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
Jupiter notebook common shortcut keys
解决‘tuple‘ object has no attribute ‘lower‘
Windows redis installation and simple use
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
Live800在线客服系统:跨越时空做生意,从每次互动开始
毕业旅行 | 伦敦5日游行程推荐
MySQL queries data by day, week, month, quarter and year