当前位置:网站首页>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
}
}
边栏推荐
- Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
- The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
- Recently prepared to translate foreign high-quality articles
- Basic operator
- Sword finger offer 46 Translate numbers to strings (DP)
- cookie、session、token
- 【opencv450-samples】inpaint 使用区域邻域恢复图像中的选定区域
- UE4_UE5结合offline voice recognition插件做语音识别功能
- 【AXI】解读AXI协议原子化访问
- [opencv450 samples] create image list yaml
猜你喜欢

Fegin client entry test

Visual studio code create minimal web API (asp.net core)

UE4_UE5結合offline voice recognition插件做語音識別功能

Kubernetes cluster construction of multiple ECS

首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千

提取系统apk

hiberate核心API/配置文件/一级缓存详解

Multithreaded learning 2- call control

Xinchida nd04 nd04c nrf52832 (52810) ble module (low power Bluetooth communication module) at command test

毕业旅行 | 伦敦5日游行程推荐
随机推荐
【ModuleBuilder】GP服务实现SDE中两个图层相交选取
RepOptimizer: 其实是RepVGG2
C language (I)
问题记录与思考
ACM. Hj16 shopping list ●●
分享一个OSGeo4W64下载好的库,基于qgis3.10的
我的vscode
cookie、session、token
Rk3568+ Hongmeng industrial control board industrial gateway video gateway solution
Konva series tutorial 2: drawing graphics
Informatics Orsay all in one 1353: expression bracket matching | Luogu p1739 expression bracket matching
What is CDN acceleration
OBS-Studio-27.2.4-Full-Installer-x64.exe 下载
LeetCode-1528-重新排列字符串-哈希表-字符串
字符串
When are the three tools used for interface testing?
OpenJudge NOI 2.1 15:Counterfeit Dollar
Jupiter notebook common shortcut keys
头歌 第3关:使用线程锁(Lock)实现线程同步
Meta universe standard forum established