How to remotely start an installed apk

Maybe this is useful not only to me but also for others (it took me a while to figure it out…)

The following cmd (on windows) allows to remotely start an installed akp.

adb shell am start -n [bundle-identifier]/com.unity3d.player.UnityPlayerNativeActivity

so in case you want to implement your own build pipeline in c#, you can use it:

//adb install -r myproject.apk
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = “adb”;
p.StartInfo.Arguments = string.Format(“install -r {0}”, _myApk);
p.Start();
p.WaitForExit();
}

// adb shell am start -n com.myproject.name/com.unity3d.player.UnityPlayerNativeActivity
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = “adb”;
p.StartInfo.Arguments = string.Format(“shell am start -n {0}/com.unity3d.player.UnityPlayerNativeActivity”, _bundleIdentifier);
p.Start();
}

how one will do this on device directly?
Like how I can check if apk is installed on device or not and if not then install apk.
How to?

hi…
i have a small query i.e.,i build apk like mystuff.apk.Now i want to run this apk from another apk like mystuffrun.apk in OnMouseDown(),is it possible.if possible help me out from this problem…

I want to install mystuff.apk,i wrote like this in start() function,but my apk is not installing
void Start()
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = “adb”;
p.StartInfo.Arguments = string.Format(“install -r {0}”,“mystuff.apk”);
p.Start();
p.WaitForExit();
}