public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { instance = this; AppInstanceManager theInstance = AppInstanceManager.Instance; appSetting = theInstance.getAppSetting(); if (!theInstance.isConnected) { if (appSetting != null) { new System.Threading.Thread(new System.Threading.ThreadStart(() => { theInstance.setupConnection(appSetting.getIPAddress(), int.Parse(appSetting.getTcpPort())); })).Start(); } } setupService(false); return(StartCommandResult.NotSticky); }