Package com.unitech.api.util
Class ServiceHandler
java.lang.Object
com.unitech.api.util.ServiceHandler
Created by USER
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic interface -
Constructor Summary
ConstructorsConstructorDescriptionServiceHandler(Context context, ComponentName componentName, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback) ServiceHandler(Context context, ComponentName componentName, String action, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback) ServiceHandler(Context context, String packageName, String action, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback) -
Method Summary
Modifier and TypeMethodDescriptionbooleanTry to bindService.booleanlongGet a ticket for a work continued longer than 30 sec.longGet a ticket for a workbooleanisTicketExist(long ticket) Check if your ticket is existbooleanreleaseTicket(long ticket) Release your working ticket
-
Constructor Details
-
ServiceHandler
public ServiceHandler(Context context, String packageName, String action, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback) -
ServiceHandler
public ServiceHandler(Context context, ComponentName componentName, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback) -
ServiceHandler
public ServiceHandler(Context context, ComponentName componentName, String action, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback)
-
-
Method Details
-
checkServiceAccessable
public boolean checkServiceAccessable() -
bindService
public boolean bindService()Try to bindService. Cannot run on main thread- Returns:
-
getTicket
public long getTicket()Get a ticket for a work- Returns:
- Working ticket
-
getImmortalTicket
public long getImmortalTicket()Get a ticket for a work continued longer than 30 sec.- Returns:
- Immortal working ticket
-
releaseTicket
public boolean releaseTicket(long ticket) Release your working ticket- Parameters:
ticket- Your working ticket- Returns:
- The result of removing ticket
-
isTicketExist
public boolean isTicketExist(long ticket) Check if your ticket is exist- Parameters:
ticket-- Returns:
-