Auto launching app after compile?

Monkey Targets Forums/Android/Auto launching app after compile?

trinode(Posted 2011) [#1]
Hello,

When I compile for html5 it launches a browser and my app, but when I use android it doesn't is there any way to make it launch my app after copying it to my device?

using eclipse to develop apps it seems to kill the current instance of my app, then deploy it, then run it, this would be the ideal way, for me at least.

- Anthony


therevills(Posted 2011) [#2]
To do this you need to alter the android.monkey in the src\trans\target folder.

In the MakeTarget method at the bottom you will see an IF statement which starts with:

If OPT_BUILD


Change it so it looks like this:

		If OPT_BUILD
		
			Execute "adb start-server"
			
			'Don't die yet...
			Local r=Execute( "ant clean",False ) And Execute( "ant install",False )
			
			'...always execute this or project dir can remain locked by ADB!
			Execute "adb kill-server",False

			If Not r
				Die "Android build failed."
			Else
				If OPT_RUN
					Execute "adb shell am start -n "+app_package+"/"+app_package+".MonkeyGame", False
					Execute "adb kill-server",False
				End
			Endif
		Endif


The new code is this bit:
				If OPT_RUN
					Execute "adb shell am start -n "+app_package+"/"+app_package+".MonkeyGame", False
					Execute "adb kill-server",False
				End


Save the file and compile trans, rename the exe to trans_winnt.exe and move the new exe to your Monkey bin folder.