From 0609374372d5df67a50ceaef5c956b5064e776fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Thu, 10 Nov 2016 15:58:31 +0100 Subject: [PATCH 01/11] Update README.md added more adb actions. --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad69024..c5346e0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ - __Debug Keystore__ - __Release Keystore__ - __ADB__ + - __Server actions__ - __Show cold start Activity time__ - __Database__ - __Watching StrictMode__ @@ -72,6 +73,19 @@ $ keytool -list -v -keystore {path_to_keystore}/my-release.keystore -alias {alia ### ADB + +### Server actions + +The following command kills the adb server: +```sh +adb kill-server +``` + +This starts the adb server: +```sh +adb start-server +``` + #### Show cold start Activity time @@ -139,8 +153,9 @@ $ 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. ``` @@ -155,6 +170,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 @@ -525,7 +546,6 @@ You may need to run the second command more than once. Repeat it until the devic $ adb -d shell am start --ez show_night_mode true com.android.systemui/.tuner.TunerActivity ``` -
From 5e1932dac251e1a5ec13fe5b7a67479f14f99c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Thu, 10 Nov 2016 16:31:19 +0100 Subject: [PATCH 02/11] Update README.md push and pull local files to device/emulator. --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c5346e0..88fb188 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ - __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) - __AAPT__ - __Check Permissions in order to avoid Play Store app filtering__ @@ -74,7 +75,7 @@ $ keytool -list -v -keystore {path_to_keystore}/my-release.keystore -alias {alia ### ADB -### Server actions +#### Server actions The following command kills the adb server: ```sh @@ -548,6 +549,35 @@ $ adb -d shell am start --ez show_night_mode true com.android.systemui/.tuner.Tu
+
+##### 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 +``` + +
+
### AAPT From a09406ce7d7c613e61c299119a36ac580b07b1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Fri, 9 Dec 2016 11:42:43 +0000 Subject: [PATCH 03/11] Update README.md Added device selection instructions. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 88fb188..1bffd31 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ - __Debug Keystore__ - __Release Keystore__ - __ADB__ + - [__Select a device when multiple devices are connected__](#select-a-device-when-multiple-devices-are-connected) - __Server actions__ - __Show cold start Activity time__ - __Database__ @@ -74,6 +75,14 @@ $ 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 From 2784dcdf53fd65da4d503c4b49fde3f193d6188c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Fri, 9 Dec 2016 11:43:28 +0000 Subject: [PATCH 04/11] Update README.md fixed error related to instructions. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bffd31..250f1c4 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ You can use `adb devices -l` to check information related to them, in order to s ``` adb -s ``` -where is the number listed when you use `adb devices` and are the instructions you want to execute over the device. +where `` is the number listed when you use `adb devices` and `` are the instructions you want to execute over the device. #### Server actions From 2ec208919c77ca81a8db896e8b02caac0c3a76fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Sun, 16 Apr 2017 08:43:03 +0100 Subject: [PATCH 05/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 250f1c4..d1a0d3d 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,8 @@
-
### 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): From 27527c65a39fd33cb257b2f371886ae0500cbcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Mon, 17 Apr 2017 17:52:10 +0100 Subject: [PATCH 06/11] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index d1a0d3d..5fc0b90 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ - __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__ @@ -585,6 +586,28 @@ Sample: 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 +
From c176abc29b445790bdb07177c0cfbebbc4077cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Mon, 17 Apr 2017 17:53:59 +0100 Subject: [PATCH 07/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fc0b90..dd193f1 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ - __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) + - [__Trigger a notification without GCM__](trigger-a-notification-without-gcm) - __AAPT__ - __Check Permissions in order to avoid Play Store app filtering__ From 6712a83734f930209fdf23a7fb7108e136146f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Mon, 17 Apr 2017 17:54:32 +0100 Subject: [PATCH 08/11] Updated bold title in the table of content From 72e40cf5bc987ddd04860a45640613118aed8adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Mon, 17 Apr 2017 17:56:02 +0100 Subject: [PATCH 09/11] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index dd193f1..1d44a16 100644 --- a/README.md +++ b/README.md @@ -35,16 +35,16 @@ - __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) + - __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__ From a204fdf1380bfc2890fd6578f6b4dec6e92cc14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Sat, 29 Apr 2017 11:03:03 -0400 Subject: [PATCH 10/11] Update README.md --- README.md | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1d44a16..1e2db2d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - __ADB__ - [__Select a device when multiple devices are connected__](#select-a-device-when-multiple-devices-are-connected) - __Server actions__ - - __Show cold start Activity time__ + - [__Show launcher activity cold start time__](#show-launcher-activity-cold-start-time) - __Database__ - __Watching StrictMode__ - __View connected devices__ @@ -97,17 +97,44 @@ This starts the adb server: adb start-server ``` - -#### Show cold start Activity time +
-```sh +#### 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`: + ``` -ActivityManager: Displayed com.example.launchtime/.LaunchTime: +666ms +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 From 85cbd6c60a4d1dbf8ee40c8ffb63536ceb4ac73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=C3=ADez=20S=C3=A1nchez?= Date: Fri, 8 Jun 2018 11:24:27 -0400 Subject: [PATCH 11/11] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1e2db2d..72a8cd2 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,11 @@ $ adb shell am start -n com.package.name/com.package.name.ActivityName ```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