diff --git a/README.md b/README.md
index d40c1fe..72a8cd2 100644
--- a/README.md
+++ b/README.md
@@ -3,40 +3,55 @@
#### Table of Contents
- __SHA-1__
- - __Debug Keystore__
- - __Release Keystore__
+ - __Debug Keystore__
+ - __Release Keystore__
- __ADB__
- - __Database__
- - __Watching StrictMode__
- - __View connected devices__
- - __Install an application__
- - __Uninstall an application__
- - __Start an Activity__
- - __Take an screenshot__
- - __Power button__
- - __Unlock screen__
- - __Print all installed packages__
- - __Simulate application being killed__
- - __Screen recording using Android 4.4__
- - __Check battery stats__
- - __Auto Backup Data (only in Android M)__
- - __Simulate fingerprint inputs (only in Android M)__
- - __Filter by tagname in Logcat__
- - __Filter by priority in Logcat__
- - __Filter using grep in Logcat__
- - __See the executed SQL statements in plain text in Logcat__
- - __Testing - Execute Monkey to test user interaction__
- - __Find out processor version on Android Device (check if it's an ARM, for example)__
- - __Retrieve application's private data and databases for non debug application without root access__
- - __Indentify Frame Rate Issues (Dumpsys)__
- - __Use ADB over Wi-Fi without extra application or software__
+ - [__Select a device when multiple devices are connected__](#select-a-device-when-multiple-devices-are-connected)
+ - __Server actions__
+ - [__Show launcher activity cold start time__](#show-launcher-activity-cold-start-time)
+ - __Database__
+ - __Watching StrictMode__
+ - __View connected devices__
+ - __List of running services__
+ - __Install an application__
+ - __Uninstall an application__
+ - __Start an Activity__
+ - __Open a deep linking intent__
+ - __Take an screenshot__
+ - __Power button__
+ - __Unlock screen__
+ - __Print all installed packages__
+ - __Get the path of an installed application__
+ - __Simulate application being killed__
+ - __Screen recording using Android 4.4__
+ - __Check battery stats__
+ - __Auto Backup Data (only in Android M)__
+ - __Simulate fingerprint inputs (only in Android M)__
+ - __Filter by tagname in Logcat__
+ - __Filter by priority in Logcat__
+ - __Filter using grep in Logcat__
+ - __See the executed SQL statements in plain text in Logcat__
+ - __Testing - Execute Monkey to test user interaction__
+ - __Find out processor version on Android Device (check if it's an ARM, for example)__
+ - [__Test Alarms__](#test-alarms)
+ - [__Query a Content Provider__](#query-a-content-provider)
+ - __Find out Application Binary Interface (ABI) in different devices__
+ - __Retrieve application's private data and databases for non debug application without root access__
+ - __Indentify Frame Rate Issues (Dumpsys)__
+ - __Use ADB over Wi-Fi without extra application or software__
+ - __Test new Marshmallow permissions__
+ - __Testing your app with App Standby__
+ - __Testing your app with Doze__
+ - __Enabling Night Mode on Android Nougat__
+ - [__Copy files from/to a device/emulator__](#copy-files-emulator)
+ - [__Trigger a notification without GCM__](#trigger-a-notification-without-gcm)
- __AAPT__
- - __Check Permissions in order to avoid Play Store app filtering__
+ - __Check Permissions in order to avoid Play Store app filtering__
-
### SHA-1
+
In order to get SHA1 to use it in many services, like Google+ Sign In, Maps, In app purchases, we should generate keys for every keystore (certificate):
@@ -61,21 +76,81 @@ $ keytool -list -v -keystore {path_to_keystore}/my-release.keystore -alias {alia
### ADB
+#### Select a device when multiple devices are connected
+
+You can use `adb devices -l` to check information related to them, in order to select the one you want. Then:
+```
+adb -s
+```
+where `` is the number listed when you use `adb devices` and `` are the instructions you want to execute over the device.
+
+
+#### Server actions
+
+The following command kills the adb server:
+```sh
+adb kill-server
+```
+
+This starts the adb server:
+```sh
+adb start-server
+```
+
+
+
+#### Show launcher activity cold start time
+
+[__Source__](https://www.youtube.com/watch?v=oJAS7T-qurk)
+
+```
+$ adb logcat | grep "ActivityManager"
+```
+
+The output would be something similar to:
+
+```
+ActivityManager: Displayed com.example.launchtime/: +666ms
+```
+
+If we also use want to show the content ready time, we should use the API method `reportFullyDrawn`:
+
+```
+ActivityCompatAdditions.reportFullyDrawn(this);
+```
+Then the time output will be the actual time that takes to Activity to be ready:
+```
+ActivityManager: Displayed com.example.launchtime/.LaunchTimeActivity: +666ms
+ActivityManager: Fully drawn com.example.launchtime/.LaunchTimeActivity: +1s440ms
+```
+
+Amount of time that takes to draw the first frame + the content.
+
+We can also use the `Activity` start command from ADB, with the `W` flag:
+
+```
+adb shell am start -W com.package.name/.LauncherScreenActivity
+```
+
+We will see 3 times related to starting times.
+
+
+
#### Database
[__This__](https://gist.github.com/ignasi) is a Database getter script, developed by [__Ignasi__](https://github.com/ignasi)
```sh
#!/bin/bash
-
-# android 4.3+ changes app's internal directory permissions and you can not just pull your
+
+# android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so this is a workaround to extract your databases.
# I only use it for debug, use it under YOUR responsability. IT REQUIRES ROOT
-
+
package=$1
db_name=$2
path="/data/data/$package/"
-
+
rm $db_name
adb shell "su -c 'cd $path; chmod -R 777 databases; exit'; exit"
adb pull $path/databases/$db_name
@@ -85,9 +160,9 @@ open $db_name
#### Watching StrictMode
-If you’re using `penaltyLog()`, the default, just run
+If you’re using `penaltyLog()`, the default, just run
```sh
-$ adb logcat
+$ adb logcat
```
and watch the terminal output. Any violations will be logged to your console, slightly rate-limited for duplicate elimination.
@@ -102,14 +177,23 @@ $ adb shell dumpsys dropbox data_app_strictmode --print
```sh
$ adb devices
```
+
If multiple devices are attached, use `adb -s DEVICE_ID` to target a specific device
+
+#### List of running services
+
+```sh
+$ adb shell dumpsys activity services
+```
+
#### Install an application
```sh
-$ adb install -r file.apk
-# Optional -r argument reinstalls and keeps any data if the application is already installed on the device.
+$ adb install -r file.apk // (or com.package.name)
+# optional -r argument reinstalls and keeps any data if the application is already installed on the device.
+# optional -s argument installs the app on the SD card instead of the internal storage.
```
@@ -124,6 +208,12 @@ To uninstall the application using uninstall dialog:
$ adb shell am start -a android.intent.action.DELETE -d package:com.package.name
```
+To keep the data in the cache directory, add `-k`
+
+```sh
+$ adb uninstall -k com.package.name
+```
+
#### Start an Activity
@@ -132,6 +222,18 @@ $ adb shell am start -n com.package.name/.ActivityName
$ adb shell am start -n com.package.name/com.package.name.ActivityName
```
+
+#### Open a deep linking intent
+
+```sh
+$ adb shell am start -n android.intent.action.VIEW -d "scheme://app/deep/linking"
+```
+or
+```sh
+$ adb shell am start -n android.intent.action.VIEW -d "https://name.app/user-settings/324" com.packaging.app
+```
+
+
#### Take an screenshot
@@ -170,6 +272,13 @@ $ adb shell inout text "KEYCODE_POWER" "KEYCODE_MENU"
$ adb shell pm list packages -f
```
+
+#### Get the path of an installed application
+
+```sh
+$ adb shell pm path app.package.application-name
+```
+
#### Simulate application being killed
@@ -271,7 +380,7 @@ The Monkey is a program that runs on your emulator or device and generates pseud
```sh
$ adb shell monkey [options]
# Basic, make 500 random actions.
-$ adb shell monkey -p your.package.name -v 500
+$ adb shell monkey -p your.package.name -v 500
```
Complete information at http://developer.android.com/tools/help/monkey.html
@@ -283,6 +392,39 @@ Complete information at http://developer.android.com/tools/help/monkey.html
$ adb shell cat /proc/cpuinfo
```
+#### Test Alarms
+
+[__Source__](http://vitovalov.com/2016/07/18/adb-date-changer.html)
+
+To check the alarms that are set on the connected device and to know more about them:
+
+```shell
+$ adb shell dumpsys alarm
+```
+
+To see the alarms from you app you can grep with your package keywords:
+```shell
+$ adb shell dumpsys alarm | grep -A 3 google
+```
+
+So now you can see if you have correctly implemented your alarms functionality using AlarmManager API.
+
+[__More info here__](http://vitovalov.com/2016/07/18/adb-date-changer.html)
+
+#### Query a Content Provider
+
+```shell
+$ adb shell content query --uri content://your.package.name --projection name
+```
+
+
+#### Find out Application Binary Interface (ABI) in different devices
+
+__ABI__ (Application Binary Interface) is gonna tell us if an Android device support 64-bit. So using the next command the developer know if the device is __32-bit__ or __64-bit__ based.
+```sh
+$ adb shell getprop ro.product.cpu.abi\
+```
+
#### Retrieve application's private data and databases for non debug application without root access
@@ -317,7 +459,7 @@ What matter is the three columns shown. Copy paste results in a spreadsheet. And

-This is the data you can grab. You can create a stack graph, so every bar contains the sum of the three columns on the left in the data we output. Is the time it takes to update the display list on every frame.
+This is the data you can grab. You can create a stack graph, so every bar contains the sum of the three columns on the left in the data we output. Is the time it takes to update the display list on every frame.
* The middle column is called process display list. It's the time we take to draw the actual display list
* The last column is the time we take to swap the buffers, so to give the buffer back to surface flinger. Scrolling or doing any kind of actions should be below 16 millisecond limit. So this app is running at 60FPS, we're vsync'd, everything is going great. You can see that most of the time, you should spend most of the time in process display list, so drawing, executing the display list should be where you spend the bulk of the time.
@@ -350,7 +492,7 @@ $ adb usb
$ adb devices
```
-* Change adb mode from USB to tcpip using following command.
+* Change adb mode from USB to tcpip using following command.
```sh
$ adb tcpip 5555
# Restarting in TCP mode port: 5555.
@@ -359,7 +501,7 @@ $ adb tcpip 5555
* Now, adb is running over TCP/IP mode, Let’s find IP address of Android device. Go to Settings in Android device -> About -> Status -> IP address. note down the IP address of connected Android Device.
* Use following command to connect ADB with IP address
```sh
-$ adb connect #.#.#.#
+$ adb connect #.#.#.#
# Connected to #.#.#.#:5555.
```
@@ -376,6 +518,128 @@ Use following command to change ADB mode to USB
$ adb usb
```
+
+#### Test new Marshmallow permissions
+
+In order to test permissions targeting API 23+, we could use following commands to programatically grant and revoke permissions on the device:
+```sh
+$adb pm grant
+```
+or
+```sh
+$adb pm revoke
+```
+
+
+
+
+#### Testing your app with App Standby
+
+[__Source__](http://developer.android.com/intl/ru/training/monitoring-device-state/doze-standby.html?utm_campaign=android_series_appstandby_012116&utm_source=medium&utm_medium=blog#testing_your_app_with_app_standby)
+
+To test the App Standby mode with your app:
+
+- Configure a hardware device or virtual device with an Android 6.0 (API level 23) or higher system image.
+- Connect the device to your development machine and install your app.
+- Run your app and leave it active.
+- Force the app into App Standby mode by running the following commands:
+```sh
+$ adb shell dumpsys battery unplug
+$ adb shell am set-inactive true
+```
+
+- Simulate waking your app using the following commands:
+```sh
+$ adb shell am set-inactive false
+$ adb shell am get-inactive
+```
+
+- Observe the behavior of your app after waking it. Make sure the app recovers gracefully from standby mode. In particular, you should check if your app's Notifications and background jobs continue to function as expected.
+
+
+
+
+#### Testing your app with Doze
+
+[__Source__](http://developer.android.com/intl/ru/training/monitoring-device-state/doze-standby.html?utm_campaign=android_series_appstandby_012116&utm_source=medium&utm_medium=blog#testing_your_app_with_app_standby)
+
+You can test Doze mode by following these steps:
+
+- Configure a hardware device or virtual device with an Android 6.0 (API level 23) or higher system image.
+- Connect the device to your development machine and install your app.
+- Run your app and leave it active.
+- Shut off the device screen. (The app remains active.)
+- Force the system to cycle through Doze modes by running the following commands:
+```java
+$ adb shell dumpsys battery unplug
+$ adb shell dumpsys deviceidle step
+```
+
+You may need to run the second command more than once. Repeat it until the device state changes to idle.
+
+- Observe the behavior of your app after you reactivate the device. Make sure the app recovers gracefully when the device exits Doze.
+
+
+
+
+#### Enabling Night Mode on Android Nougat
+
+[__Source__](http://michaelevans.org/blog/2016/08/23/enabling-night-mode-on-android-nougat/)
+```
+$ adb -d shell am start --ez show_night_mode true com.android.systemui/.tuner.TunerActivity
+```
+
+
+
+
+##### Copy files from/to a device/emulator
+
+[__Source__](http://crushingcode.co/do-you-like-to-adb/)
+
+To push a file/dir to device:
+```sh
+$ adb push
+```
+where `` is file in your local system i.e my_image.png and `` is file location in device/emulator i.e `/sdcard/Downloads/my_image.png`
+
+Sample:
+```sh
+$ adb push ~/Downloads/my_image.png /sdcard/Downloads/my_image.png
+```
+To pull a file/dir from device
+
+```sh
+$ adb pull []
+```
+where `` is file in your local system i.e my_image.png and `` is file location in device/emulator i.e `/sdcard/Downloads/my_image.png`.
+
+Sample:
+```sh
+adb pull /sdcard/Downloads/my_image.png my_image.png
+```
+
+#### Trigger a notification without GCM
+
+[Source](https://plus.google.com/108612553581259107752/posts/ERVnjUAjsbZ)
+
+**IMPORTANT**: Remember to remove **temporally** the following attribute from the declaration of the Broadcast Receiver you want to test, in the Manifest:
+```
+android:permission="com.google.android.c2dm.permission.SEND"
+```
+
+It's based on enabling broadcast receivers.
+```
+am broadcast -a -n /
+```
+
+Some examples could be:
+```
+adb shell am broadcast -a com.whereismywifeserver.intent.TEST --es sms_body "test from adb"
+adb shell am broadcast -a com.google.android.c2dm.intent.REGISTRATION -n de.example/.GCMBroadcastReceiver
+--es "registration_id" "1234"
+```
+where `--es` define extra as string
+
@@ -438,6 +702,3 @@ supports-any-density: 'true'
locales: '--_--'
densities: '120' '160' '240' '320'
```
-
-
-