Skip to content

Instantly share code, notes, and snippets.

@IvanJamesVR
Last active July 3, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanJamesVR/3175265b047dad61c817ea0a08cd5dd1 to your computer and use it in GitHub Desktop.
Save IvanJamesVR/3175265b047dad61c817ea0a08cd5dd1 to your computer and use it in GitHub Desktop.
import subprocess
import time
import os
gameName = "MyQuestGame"
companyName = "YourCompany"
maxTries = 20
# Reboot Quest
subprocess.run("adb reboot")
print("\nQuest rebooting ...")
# Check for device
time.sleep(20)
print("\nWaiting for Quest ...")
connected = False
offlineTries = maxTries
while not connected:
result = subprocess.check_output("adb devices")
result = (str(result).replace('\\r','').split('\\n')[1])
if 'device' in result:
print("\nQuest connected")
connected = True
elif 'offline' in result:
if offlineTries == 0:
print("\nTry to unplug/replug your Quest")
offlineTries = maxTries
else:
offlineTries = offlineTries - 1
time.sleep(1)
else:
time.sleep(1)
subprocess.run("adb shell am start -n com."+companyName+"."+gameName+"/com.epicgames.ue4.GameActivity")
print("\n------------- Game", gameName,'launched ! -------------\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment