.. -*- coding: utf-8; -*-========== Android.==========.. contents:: :local:Official docs=============http://developer.android.com/sdk/index.html Get the Android SDKhttp://developer.android.com/guide/index.html Introduction to Androidhttps://android.googlesource.com/platform/system/core/+/master/init/readme.txt init.rd file syntax.Getting tools=============https://developer.android.com/studio/releases/platform-tools.html SDK Platform Tools (includes adb and fastboot) download and rellease changelog.https://developer.android.com/studio/index.html Android Studio (official IDE for Android) and sdk-tools (includes ``sdkmanager``).Android emulator================Intel provided images and hypervisor to run x86 Android port with acceleration:https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm Intel® Hardware Accelerated Execution Manager (Intel® HAXM). It is available from SDK manager also.It starts service. To manage service use:: sc stop intelhaxm sc start intelhaxmAndroid stats=============CPU:: $ cat /proc/cpuinfo $ cat /proc/cpufreq/cpufreq_freqMemory:: $ cat /proc/meminfoAndroid API levels.===================http://developer.android.com/guide/topics/manifest/uses-sdk-element.html "Platform Version / API Level" table.Package repositories.=====================https://play.google.com/ Google package repository.https://f-droid.org/ Free software repository.http://www.appbrain.com/ AppBrain, alternative catalog to Google Play. Packages is backed via lisnk to Google Play.Link to package description page:: https://play.google.com/store/apps/details?id=com.google.android.talkSee also:http://android.stackexchange.com/questions/216/what-are-the-alternative-android-app-markets/ What are the alternative Android app markets?Mods.=====http://xda-university.com/ How to mod.http://www.cyanogenmod.org/about CyanogenModhttps://www.clockworkmod.com/ ClockworkModConnect to Android via USB by adb in Linux==========================================Add ``udev`` rule for fix permission issues:: $ cat /etc/udev/rules.d/90-android.rules # Standard Google device. SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c03", MODE="0666", GROUP="plugdev" # China N101 II SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0010", MODE="0666", GROUP="plugdev"Reload udev rules and re-plug device via USB:: $ sudo service udev force-reloadSee:http://developer.android.com/tools/device.html Setting up a Device for Development.Connect to Android via USB by adb in Windows============================================Get latest official Google drivers from:https://developer.android.com/studio/run/win-usb.html Get the Google USB Driver.If your device isn't in official list you can try to find driver in `Windowsupdate catalog at http://www.catalog.update.microsoft.com`__.__ http://www.catalog.update.microsoft.comUse search by vendor or device name, or string ``adb``. Alternatively use`hardware id`_.BTW older version of official Google drivers are also in `Windows updatecatalog`__.__ http://www.catalog.update.microsoft.com/Search.aspx?q=google+adbMost probably you will fail to find drivers for numerous Chinese/noname Androiddevices. We can reuse official Google drivers. To do that:.. _hardware id:* Find your USB's hardware VID and PID. Locate your device in *Device Manager*, open Properties => Details => Hardware Ids and copy (by ``Ctrl+C``) string like:: USB\VID_2A45&PID_201D&MI_01* Extract official Google's ADB driver package:: unzip latest_usb_driver_windows.zip* Locate and modify driver's ``.inf`` file (in my case it was ``android_winusb.inf``) by adding lines, like:: ; Meizu %SingleAdbInterface% = USB_Install, USB\VID_2A45&PID_201D %CompositeAdbInterface% = USB_Install, USB\VID_2A45&PID_201D&MI_01 to all sections that has similar lines setting your own `hardware id`_ that we've extracted.* Temporary disable driver signing enforcement (run from Administrator, ``Win``, type ``cmd``, ``Ctrl+Shift+Enter``):: cmd# bcdedit /set testsigning off and reboot. You'll see ``Test mode`` sign in right lower corner of desktop.* Locate your decive, then follow *Properties => Driver => Update => Browse my computer => Let me pick => Hard Disk...*. Select *Android Composite ADB interface* driver and ignore security warning about broken file signature.* Enable signing checks back:: cmd# bcdedit /set testsigning on and reboot. Hurrah!.. note:: As you see Google's adb driver works fine with any Android phone. It's Microsoft policy to forbid class drivers so each vendor is required to provide same driver with different hardware ID and to pay money for Windows Logo® program and signing process... tip:: ``bcdedit`` can be run with alternative options:: cmd# bcdedit.exe /set nointegritychecks on cmd# bcdedit.exe /set nointegritychecks offRecovery.=========To enter phone to recovery mode press ``VolumeDown``+``Power`` button or:: adb reboot recoverySee:http://teamw.in/project/twrp2 Custom recovery built.ADB tips.=========List available devices:: $ adb devicesInstall application from ``.apk`` file:: $ adb install -r /path/to/application.apkList installed package names (with path to ``.apk`` files!):: $ adb shell 'pm list packages -f' $ adb shell 'cmd package list packages -f'Uninstall application by its package name:: $ adb uninstall PACKAGE_NAMEDisable/enable application:: $ adb shell pm disable PACKAGE_NAME $ adb shell pm enable PACKAGE_NAMEList of disabled packages:: $ adb shell pm list packages -dList of application properties (version, permissions, etc):: $ adb shell dumpsys package $PKGList currently run activities:: $ adb shell 'dumpsys activity'Find activities from package:: $ adb shell 'pm list packages -f' $ adb pull APK_FROM_LIST $ aapt dump badging APK_FILEStart an activity:: $ adb shell am start PACKAGE_NAME/ACTIVITY_IN_PACKAGE $ adb shell am start PACKAGE_NAME/FULLY_QUALIFIED_ACTIVITYStart an activity with action filter:: android# am start -a com.example.ACTION_NAME -n com.package.name/com.package.name.ActivityNameList of running processes:: $ adb shell psor (supported arguments``user,group,comm,args,pid,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,stat,rss``):: $ adb shell % ps -o pid,user,group,rss,vsz,argsTo kill process:: $ adb shell ps | grep $REGEX $ adb shell kill $PIDTo stop application:: $ adb shell am kill com.google.android.contacts $ adb shell am force-stop com.google.android.contactsTake a screenshort:: $ adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.pngPower button:: $ adb shell input keyevent 26Unlock screen:: $ adb shell input keyevent 82Show system log:: $ adb logcat $ adb logcat "*:W"dumpsys=======Info from all services:: $ adb shell dumpsysList of available services:: $ adb shell service listInfo from concrete service:: $ adb shell dumpsys phone $ adb shell dumpsys diskstats $ adb shell dumpsys usb $ adb shell dumpsys activity $ adb shell dumpsys package $ adb shell dumpsys display $ adb shell dumpsys gfxinfo $ adb shell dumpsys power $ adb shell dumpsys battery $ adb shell dumpsys batteryinfo $ adb shell dumpsys cpuinfo $ adb shell dumpsys dbinfo $ adb shell dumpsys meminfo $ adb shell dumpsys account $ adb shell dumpsys netstats* https://source.android.com/devices/tech/debug/dumpsys.html* http://stackoverflow.com/questions/11201659/whats-the-android-adb-shell-dumpsys-tool-and-what-are-its-benefitsList partition.===============List partitions (with sizes):: android# cat /proc/partitions android# cat /proc/mtdList mounted file systems:: android# mount android# dfRemount /system as RW=====================Usually with:: $ adb remountIf you have root but above command fail:: $ adb shell android# su android# mount | grep /system ... android# mount -o remount,rw /systemWorking with apk files======================Getting package name, version, API requirements and permissions:: $ aapt dump badging $FILE.apkControlling Android from PC.============================* http://code.google.com/p/androidscreencast/* http://code.google.com/p/android-screen-monitor/* http://androidwebkey.com/Show screencast from Android.=============================http://droid-at-screen.org/ Easily show the screen of an Android device on a computer/laptop (PC, Mac, Linux, ...) and then project the desktop using a LCD-projector.http://droid-at-screen.ribomation.com/ Old DNS name.