Package com.clover.sdk.v1.printer
Class ReceiptRegistrationConnector
- java.lang.Object
-
- com.clover.sdk.v1.ServiceConnector<IReceiptRegistrationService>
-
- com.clover.sdk.v1.printer.ReceiptRegistrationConnector
-
- All Implemented Interfaces:
ServiceConnection
public class ReceiptRegistrationConnector extends ServiceConnector<IReceiptRegistrationService>
A class that encapsulates interaction withIReceiptRegistrationService
. This class automatically binds upon invocation of it's service methods (e.g.,register(Uri)
.Clients of this class may optionally call
ServiceConnector.connect()
to force pre-binding to the underlying service, and must callServiceConnector.disconnect()
when finished interacting with the underlying service.While this class originally provided both synchronous and asynchronous methods for interacting with the service, the asynchronous methods are now deprecated.
Consider using
Intents.ACTION_APP_PRE_UNINSTALL
to ensure your provider is unregistered when your application is uninstalled. Callunregister(Uri)
in your pre-uninstall service.If your registered receipt registration content provider fails to respond it may be temporarily or permanently disabled. See
ReceiptContract
for more information.- See Also:
ReceiptContract
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReceiptRegistrationConnector.ReceiptRegistrationCallback<T>
An implementation of theServiceConnector.Callback
interface for receiving asynchronous results fromReceiptRegistrationConnector
methods that provides default method implementations.-
Nested classes/interfaces inherited from class com.clover.sdk.v1.ServiceConnector
ServiceConnector.Callback<T>, ServiceConnector.OnServiceConnectedListener, ServiceConnector.ServiceCallable<S,T>, ServiceConnector.ServiceRunnable<S>
-
-
Field Summary
-
Fields inherited from class com.clover.sdk.v1.ServiceConnector
mAccount, mClient, mConnected, mContext, mHandler, mService
-
-
Constructor Summary
Constructors Constructor Description ReceiptRegistrationConnector(Context context, Account account, ServiceConnector.OnServiceConnectedListener client)
Construct a new printer connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<ReceiptRegistration>
getRegistrations()
Get the list of all registered receipt registrationContentProvider
s.void
getRegistrations(ServiceConnector.Callback<List<ReceiptRegistration>> callback)
Deprecated.UsegetRegistrations()
instead.protected String
getServiceIntentAction()
protected String
getServiceIntentPackage()
The package which hosts the service to connect to.protected int
getServiceIntentVersion()
Connectors that are versioned include a version number in the action returned byServiceConnector.getServiceIntentAction()
instead of using this mechanism.protected IReceiptRegistrationService
getServiceInterface(IBinder iBinder)
void
register(Uri uri)
Register a receipt registrationContentProvider
.void
register(Uri uri, ServiceConnector.Callback<Void> callback)
Deprecated.Useregister(Uri)
instead.void
unregister(Uri uri)
Unregister a receipt registrationContentProvider
.void
unregister(Uri uri, ServiceConnector.Callback<Void> callback)
Deprecated.Useunregister(Uri)
instead.-
Methods inherited from class com.clover.sdk.v1.ServiceConnector
connect, disconnect, execute, execute, execute, execute, getService, getStartIntent, isConnected, isInstalled, notifyServiceConnected, notifyServiceDisconnected, onServiceConnected, onServiceDisconnected, postResults, throwOnFailure, waitForConnection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface android.content.ServiceConnection
onBindingDied, onNullBinding
-
-
-
-
Constructor Detail
-
ReceiptRegistrationConnector
public ReceiptRegistrationConnector(Context context, Account account, ServiceConnector.OnServiceConnectedListener client)
Construct a new printer connector.- Parameters:
context
- The Context in which this connector will bind to the underlying service.account
- The Clover account which is used when binding to the underlying service.client
- A listener, or null to receive no notifications.
-
-
Method Detail
-
getServiceIntentAction
protected String getServiceIntentAction()
- Specified by:
getServiceIntentAction
in classServiceConnector<IReceiptRegistrationService>
-
getServiceIntentPackage
protected String getServiceIntentPackage()
Description copied from class:ServiceConnector
The package which hosts the service to connect to. Returning null is OK for api target < 21. Once you try to build with 21 or higher returning null will cause an illegal argument exception- Overrides:
getServiceIntentPackage
in classServiceConnector<IReceiptRegistrationService>
-
getServiceIntentVersion
protected int getServiceIntentVersion()
Description copied from class:ServiceConnector
Connectors that are versioned include a version number in the action returned byServiceConnector.getServiceIntentAction()
instead of using this mechanism.- Overrides:
getServiceIntentVersion
in classServiceConnector<IReceiptRegistrationService>
-
getServiceInterface
protected IReceiptRegistrationService getServiceInterface(IBinder iBinder)
- Specified by:
getServiceInterface
in classServiceConnector<IReceiptRegistrationService>
-
register
@Deprecated public void register(Uri uri, ServiceConnector.Callback<Void> callback)
Deprecated.Useregister(Uri)
instead.
-
register
public void register(Uri uri) throws RemoteException, ClientException, ServiceException, BindingException
Register a receipt registrationContentProvider
.- Parameters:
uri
- The "content://" URI of the receipt registration content provider.- Throws:
RemoteException
ClientException
ServiceException
BindingException
-
unregister
@Deprecated public void unregister(Uri uri, ServiceConnector.Callback<Void> callback)
Deprecated.Useunregister(Uri)
instead.
-
unregister
public void unregister(Uri uri) throws RemoteException, ClientException, ServiceException, BindingException
Unregister a receipt registrationContentProvider
.- Parameters:
uri
- The "content://" URI of the receipt registration content provider.- Throws:
RemoteException
ClientException
ServiceException
BindingException
-
getRegistrations
@Deprecated public void getRegistrations(ServiceConnector.Callback<List<ReceiptRegistration>> callback)
Deprecated.UsegetRegistrations()
instead.
-
getRegistrations
public List<ReceiptRegistration> getRegistrations() throws RemoteException, ClientException, ServiceException, BindingException
Get the list of all registered receipt registrationContentProvider
s.
-
-