public class TestService extends IntentService { private MerchantConnector merchantConnector; public TestService() { super(TestService.class.getSimpleName()); } @Override public void onCreate() { super.onCreate(); merchantConnector = new MerchantConnector(this, CloverAccount.getAccount(this), null); merchantConnector.connect(); } @Override protected void onHandleIntent(Intent intent) { Merchant merchant = merchantConnector.getMerchant(); // Do some work } @Override public void onDestroy() { if (merchantConnector != null) { merchantConnector.disconnect(); merchantConnector = null; } super.onDestroy(); } }
1 Person is following this question.