Use python to compile a batch uninstall android app script installed on mobile phones, pythonandroid

Source: Internet
Author: User

Use python to compile a batch uninstall android app script installed on mobile phones, pythonandroid

This script is used to uninstall all third-party applications installed on android phones. It mainly uses the adb shell pm and adb uninstall commands. Therefore, you must configure the environment variables of adb, the code below:

#!/usr/bin/env python import os def uninstall(): os.popen("adb wait-for-device") print "start uninstall..." for packages in os.popen("adb shell pm list packages -3").readlines(): packageName = packages.split(":")[-1].splitlines()[0] os.popen("adb uninstall " + packageName) print "uninstall " + packageName + " successed." if __name__ == "__main__": uninstall() print " " print "All the third-party applications uninstall successed." 

Compile Python scripts for android devices on a computer using a compiler

Install the Python interpreter on the Android Simulator
I know two ways to download and install Android software. One is to directly access the network through Android, download and install, and the other is to download from PC, and then install through the simulator tool ADB. The second method is described here.
Download the Python for Android interpreter;
Interpreter framework, click to download: code.google.com/...n?2&q=
Python interpreter, click to download: code.google.com/...n?2&q=
Install the Python for Android interpreter;
Set environment variables and add the path of the Android simulator tool adb.exe.
Open the cmd run interface and enter adb. You will see the following information:

Enter adb device.

Enter adb install-s <interpreter framework path>, for example, adb install-s c:/sl4a_r3.apk. After the installation is complete, the SL4A icon will appear in your android.

Install the python interpreter. For example, adb install-s c:/PythonForAndroid_r4.apk. After the installation is complete, the Python for Android icon will appear in your Android.

In Android, click Python for Android. After entering, there is an install button and click install. This program downloads all required packages through the network.
Test the Python for Android interpreter;
After everything is installed, click the SL4A icon in Android.
Click hello_world.py (or another script) in the displayed list. A small SL4A icon is displayed in the upper-left corner of the page, and "hello world!" is displayed !"

If your Android running result proves that your installation is successful, continue to the next step.
Step 4: Compile and execute Python scripts that can be run on the Android Simulator
Compile a Python Script For Android;

Pass the Python Script to the Android simulator;
Suppose your python script is stored in c:/Hello_world.py.
Open the cmd interface and run adb push <local> <remote>. For example, adb push c:/Hello_world.py/sdcard/sl4a/scripts/Hello_wold.py
Run the Python Script on the Android simulator;
Run the script on Android and you will see "Hello world !" Appears on the screen. (As shown in step 3)
If your running result is described above, congratulations... the remaining full text>

In the android system, after the program is uninstalled, how can I install an application icon in the application installation? Click the icon to install the application?

Some apk have two needs to be deleted. You can try to manage app remover in the next program.

Some programs will disappear after being uninstalled and restarted once!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.