how to enable Multi display feature on Android O - android

Did anyone tried Android multiple display feature which is new in Android O
Following steps which is not working for me
1.connect hdmi cable to mobile(not sure can use USB as well)
2.make device in root and give following command (expect app is installed)
and not seen that app is launching on secondary(Multiple display feature
) it's just reflecting mobile display as it is because connected hdmi cable
adb shell am start com.Chrome.Canary --display 1
Please suggest any other way or any command to make it work?

Android in general do mirroring when two displays are connected. Right now google has not enabled support for touch and display mapping on the two displays. But if you want to launch any activity on any of the two displays then the command adb shell am start "your_activity" --display display_id will launch your activity on that particular display id. If the above command doesn't launch your activity then you can use adb shell am stack start display_id "your activity". This will also work. But regarding touch, it will be mapped to the primary display (display id 0). As per google you can enable the mapping of touch in EventHub.cpp of Android source code but till now I haven't found it useful. Hope my answer helps you.

Ran using below procedure passed with dell monitor:
ADB shell can be used to call Activity Manager(am) for starting any system actions (or an activity).
The syntax:
adb shell am start [-n (component)] [-a (action)] [-t (mime type)] [-d (data_URL)]
examples:
1. For starting ‘Settings app’:
adb shell am start -n com.android.settings/.Settings
In the above-mentioned command, we set component(-n) to be settings in a specific format.
For starting ‘Gallery app’:
adb shell am start -t image/* -a android.intent.action.VIEW
In the above-mentioned command, we are setting action(-a) for opening the default app for gallery with mime type(-t) to be image/*
In general, for external display the ‘display_id’ starts from ‘1’ in an increasing order, final command to do multi display operation is
adb shell am start -n com.android.settings/.Settings --display 1
The above command will display ‘Settings’ app only in external display with display_id = 1. The primary display will be in the same mode as before executing the command.

Related

How to access Data Saver/Network settings using ADB commands?

trying to open Data Saver menu using ADB Commands in Android TV 9, Philips 2020. Philips covered stock Network menu using their own, so there is no way to enable/disable Data Saver as it was installed.
https://beebom.com/enable-data-saver-mode-android-tv/
https://source.android.com/devices/tech/connect/data-saver
Any help witch command I can try to display this menu or simply enable/disable Data Saver feature will be appreciated. I connected using ADB my TV with terminal in my PC already.
Commands like that works, no surprise:
adb shell am start -a android.settings.system
But when I tried to use more complex ones I get errors, nothing opens on the TV. I based on this doc - https://developer.android.com/reference/android/provider/Settings
adb shell am start -a android.settings.SETTINGS.system
Starting: Intent { act=android.settings.SETTINGS.system } Error: Activity not started, unable to resolve Intent { act=android.settings.SETTINGS.system flg=0x10000000 }
If there is a command to do so, I can map it later using Button Mapper, so it will be more user friendly in daily use.

How to see the activity/fragment related to screen in android?

Have joined a new company and am new to android ui. What is the best way to see which activity in code relates to ui which am seeing in emulator or device?
Run the app on a device and make sure the device is connected to your machine. In your terminal, run:
adb shell dumpsys activity | grep -i 'resumedactivity\|focusedactivity'
This will output the name of the activity that is currently being displayed

What is adb command to open camera in Video capture using one particular app?

I want to be able to open camera app using adb command in video capture mode:
I am already using following command for it:
adb shell am start -a android.media.action.VIDEO_CAPTURE
but if more than one applications have defined that intent then it shows me "Complete action using box". I want to avoid that box. So i wan to open that intent using one particular apk.
How can I can i do it?
If you know the packagename and the activity name of what you want to open then you can use the below
adb shell am start -a android.media.action.VIDEO_CAPTURE -n com.packagename/com.packagename.ActivityName

Can I use adb to change the default launcher program?

I set one of the program as default launcher program and default setting program so I cannot change the default programs now, can I change the default programs from android-sdk\android-sdk\platform-tools\adb.exe or remote shell.
How can I do that?
And can I remove the defaults of program in Java code?
For system apps you can't uninstall, use pm disable as in
adb shell pm disable com.android.launcher
you can remove (Uninstall) the default program you set using ADB by doing this :
adb uninstall app.package ..... //for example (com.example.homeapp)
If you don't want to remove the app .. here is a quick hack to do it:
adb shell
am start -a android.intent.action.MAIN
That way you will have a picker with all apps on your devices that listens to Main Action
Choose any home screen app you want . then go to settings and set it as default.
adb shell cmd package set-home-activity "package/activity"
adb reboot
The key is adb. Once you know the package name of the app you wish to clear data for, try:
adb shell pm clear package.name.of.app
It'll clear all data for the app, but I don't know of a way to only clear the defaults.
You can check and change the default sms app by using adb shell settings get secure sms_default_application and then use adb shell settings put secure sms_default_application <package name>. I'm not sure about the other default apps, but it's just a matter of finding it with adb shell settings list <secure/system/global>

How to reboot emulator to test ACTION_BOOT_COMPLETED?

Well, I have searched a lot. People say that I need to close the window of emulator to close it. However, I need to reboot the emulator to catch ACTION_BOOT_COMPLETED by my BroadcastReceiver.
How can I do that?
You can use the following command from adb:
adb shell am activity/service/broadcast -a ACTION -c CATEGORY -n NAME
for example:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n package_name/class_name
Note that class name and package names need to be as defined in the Manifest.
This will generate the Intent you want , directed only to the component you want (otherwise you system will go crazy with BOOT_COMPLETED sent...)
Or another way (also from the command line):
adb shell stop
adb shell start
First, make sure that USB Debugging is enabled from within the emulator:
click:
the Home icon
Menu icon
'Settings'
'Applications'
'Development'
make sure that the box next to 'USB debugging' contains a check mark
from a command-line:
adb -e reboot
EDIT:
This definitely doesn't work... very strange. I tested it and could not make the emulator reboot. It just hangs.
To emulate a broadcast action, you can connect via adb to the emulator/device and open a shell:
adb shell
Then, you can broadcast the action you want to test:
am broadcast -a android.intent.action.BOOT_COMPLETED
Please note that, in the latest Android versions, broadcasting the *android.intent.action.BOOT_COMPLETED* action will actually reboot your emulator/device.
While using tubemate on android tab, I was not successful in downloading video with the error:host interupped etc. I used the following commands:
adb shell stop
adb shell start
and the application started downloading videos.
emulators have on/off button - just click it
and another way:
If you start your emulator, and select the "wipe user data" checkbox, you will also receive that notification when boot is completed.

Categories

Resources