当前位置:网站首页>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
}
}
边栏推荐
- Multithreaded learning 1
- OpenJudge NOI 2.1 15:Counterfeit Dollar
- hiberate架构介绍及环境搭建(非常详细)
- C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
- NLP text summary: use the pre training model to perform text summary tasks [transformers:pipeline, T5, Bart, Pegasus]
- Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
- Leetcode(605)——种花问题
- Once beego failed to find bee after passing the go get command Exe's pit
- golang Make a list of intervals with sequential numbers
- 问题记录与思考
猜你喜欢

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

UE4_ Ue5 combines the offline voice recognition plug-in for speech recognition

How to add cartoon characters to the blog park?

hiberate架构介绍及环境搭建(非常详细)

ACM. HJ16 购物单 ●●

konva系列教程2:绘制图形

ACM. Hj16 shopping list ●●

Problem recording and thinking

CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)

How to use drawing comparison function in CAD
随机推荐
hiberate架构介绍及环境搭建(非常详细)
Pointer strengthening and improvement
Day4 branch and loop summary and operation
Comp212 distributed protocol
Episode 3: thread synchronization using thread lock
After xampp restarts, the MySQL service cannot be started.
Sword finger offer 46 Translate numbers to strings (DP)
Konva series tutorial 2: drawing graphics
[opencv450 samples] read the image path list and maintain the proportional display
Idea FAQ collection
NLP text summary: use the pre training model to perform text summary tasks [transformers:pipeline, T5, Bart, Pegasus]
[opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
STM32开发板+机智云AIoT+家庭监测控制系统
Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
MySQL queries data by day, week, month, quarter and year
头歌 第3关:使用线程锁(Lock)实现线程同步
解决‘tuple‘ object has no attribute ‘lower‘
jdbc常见异常及错误解决办法汇总
Transformers load pre training model
go中全类型等值判断解析&综合汇总