Batch install APK on multiple phones

Source: Internet
Author: User

1. Phone to open adb debug

2. The program can implement multiple APK batch installation for Android phone

1.getseriaonum.py module, which gets the serial number of the connected phone

ImportOSImportThreadingImport TimeImportAdbmoduleImportGetseriaonumclassinstallapk (Threading. Thread):def __init__(self): threading. Thread.__init__(self)defRun (self): Arraydev=[] Arrayapkpackage= [R'C:\Users\liangraorao\Desktop\apk\iBiliPlayer-bili.apk']         whiletrue:udid_list=getseriaonum.get_devices () forUdidinchudid_list:ifUdidinchArraydev:Continueadbmodule.installapk (Udid, Arrayapkpackage). Start () arraydev.append (UDID) ifLen (Arraydev) > 10: Arraydev.clear ()#number of phones to install = = Number of phones installed, end loopnum =Len (getseriaonum.get_devices ())ifLen (arraydev) = =Num: BreakTime.sleep (10) installapk (). Start ()
View Code

The result is: [' 1713d0b20204 ', ' 192.168.1.101:5555 ']

2.adbmodule.py package installation and uninstallation of ADB commands

1 ImportThreading2 ImportOS3 """4 arrayapkpackage: List of apk to install5 arraypackagename: APK package name to uninstall6 """7 8 classinstallapk (Threading. Thread):9     def __init__(self, Udid, arrayapkpackage):TenThreading. Thread.__init__(self) OneSelf.udid =Udid ASelf.arrayapkpackage =Arrayapkpackage -  -     defRun (self): the          forApkpackageinchSelf.arrayapkpackage: -Os.popen ('adb-s'+ Self.udid +'Install-r'+apkpackage) -  - classunstallapk (Threading. Thread): +     def __init__(self, Udid, arraypackagename): -Threading. Thread.__init__(self) +Self.udid =Udid ASelf.arraypackagename =Arraypackagename at  -     defRun (self): -          forPackageNameinchSelf.arraypackagename: -Os.popen ('adb-s'+ Self.udid +'Uninstall'+packagename)
View Code

3.exeinstall.py Batch Install APK module

1 ImportOS2 ImportThreading3 Import Time4 ImportAdbmodule5 ImportGetseriaonum6 7 8 classinstallapk (Threading. Thread):9     def __init__(self):TenThreading. Thread.__init__(self) One  A     defRun (self): -Arraydev = [] -Arrayapkpackage = [R'C:\Users\admin\Desktop\apk\iBiliPlayer-bili.apk'] the          whileTrue: -Udid_list =getseriaonum.get_devices () -              forUdidinchudid_list: -                 ifUdidinchArraydev: +                     Continue - adbmodule.installapk (Udid, Arrayapkpackage). Start () + arraydev.append (Udid) A                 ifLen (Arraydev) > 10: at arraydev.clear () -  -             #number of phones to install = = Number of phones installed, end loop -num =Len (getseriaonum.get_devices ()) -  -             ifLen (arraydev) = =Num: in                  Break -Time.sleep (10) to  +INSTALLAPK (). Start ()
View Code

4.exeuninstall.py Batch Uninstall APK

1 ImportThreading2 ImportOS3 ImportGetseriaonum4 ImportAdbmodule5 6 classunintallapk (Threading. Thread):7     def __init__(self):8Threading. Thread.__init__(self)9 Ten     defRun (self): OneArraydev = [] AArraypackagename = ['Tv.danmaku.bili'] -          whileTrue: -Udid_list =getseriaonum.get_devices () the              forUdidinchudid_list: -                 ifUdidinchArraydev: -                     Continue - adbmodule.unstallapk (Udid, Arraypackagename). Start () + arraydev.append (Udid) -                 ifLen (Arraydev) > 10: + arraydev.clear () A  at             #number of phones to install = = Number of phones installed, end loop -num =Len (getseriaonum.get_devices ()) -  -             ifLen (arraydev) = =Num: -                  Break -Time.sleep (10) in  -UNINTALLAPK (). Start ()
View Code

Batch install APK on multiple phones

Related Article

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.