com.unitech.lib.util

## Class ServiceHandler

- java.lang.Object
- - com.unitech.lib.util.ServiceHandler

-     public class ServiceHandler
      extends java.lang.Object

  Created by USER

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ServiceHandler.ServiceConnection`
    `static interface` | `ServiceHandler.ServiceConnectionCallback`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceHandler(Context context, java.lang.String packageName, java.lang.String action, ServiceHandler.ServiceConnectionCallback serviceConnectionCallback)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `bindService()` Try to bindService.
    `boolean` | `checkServiceAccessable()`
    `long` | `getImmortalTicket()` Get a ticket for a work continued longer than 30 sec.
    `long` | `getTicket()` Get a ticket for a work
    `boolean` | `isTicketExist(long ticket)` Check if your ticket is exist
    `boolean` | `releaseTicket(long ticket)` Release your working ticket

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServiceHandler

          public ServiceHandler(Context context,
                                java.lang.String packageName,
                                java.lang.String action,
                                ServiceHandler.ServiceConnectionCallback serviceConnectionCallback)

  - ### Method Detail

    - #### 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: