Start cloned app on a new display
Hello,
I want to start a cloned app, so the user ID is 999 instead of 0. But I don't know how to start it through a new-display.
I use :
--new-display="size and density" --start-app="package name"
But the package name is the same for user 0 and 999. So where can I add the user ID please to run the cloned app ? (I use adb command too)
same problem encountered.
I found a solution :
I use the scrcpy.log to open the package from the user I want in the last screen created :
Create a first bat file :
_To create batfile, new text file, modify .txt extension by .bat, open it with notepad and write this into it, don't forget to read the REM to replace the good things :
@echo off
cd C:\Users\Hei02\scrcpy
REM ====> replace C:\Users\Hei02\scrcpy by your SRCPY.exe folder location ===
scrcpy.exe --new-display="size and density"** -s XPH539325037930 > scrcpy.log 2>&1
REM ====> replace "size and density" by yours without " " ===
REM ====> replace XPH539325037930 by your device name (if you don't know open "open_a_terminal_here.bat" in your srcpy folder and type : "adb devices") ===
Create a second bat file :
@echo off
setlocal enabledelayedexpansion
cd C:\Users\Hei02\scrcpy
=>replace C:\Users\Hei02\scrcpy by your SRCPY.exe folder location
set DISPLAY_ID=
for /f "tokens=3 delims==()" %%A in ('findstr "New display:" scrcpy.log') do (
set DISPLAY_ID=%%A
)
if "!DISPLAY_ID!"=="" (
echo Erreur : No screen spotted.
pause
exit /b
)
echo new screen spotted : !DISPLAY_ID!
adb.exe -s XPH5T19322037030** shell am start --display !DISPLAY_ID! --user 11 -n "package name"
REM ====> replace XPH539325037930 by your device name (if you don't know open "open_a_terminal_here.bat" in your srcpy folder and type : _adb devices_) ===
REM ====> replace --user 11 by your other user number ((if you don't know open "open_a_terminal_here.bat" in your srcpy folder and type : _adb shell pm list users_) ===
REM ====> replace "package name" by yours and supress " " ===
pause
Then launch the first bat, then the second one. You can launch twice automaticaly with a new bat if you want.