Class Launcher


  • public class Launcher
    extends ApiBindBase
    This class provides Launcher custom related APIs.
    • Constructor Summary

      Constructors 
      Constructor Description
      Launcher​(android.content.Context context)
      This constructor will not bind the service automatically.
      Launcher​(android.content.Context context, ServiceStatusCallback callback)
      This constructor will bind the service automatically.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addAppShortcut​(java.lang.String packageName, java.lang.String className, java.lang.String title, int screen, int x, int y)
      Add app shortcut to the screen.
      boolean addOnHotseat​(java.lang.String packageName, java.lang.String className, java.lang.String title, int x)
      Add app to the hotseat
      boolean addWidget​(java.lang.String packageName, java.lang.String className, int screen, int x, int y, int spanX, int spanY)
      Add app widget to the screen.
      void bindService()
      bind service
      boolean isServiceReady()
      Check if service is ready.
      boolean remove​(long id)
      Remove app shortcut.
      boolean remove​(java.lang.String name)
      Remove app shortcut.
      boolean remove​(java.lang.String packageName, java.lang.String className)
      Remove app shortcut.
      boolean removeAll()
      Remove everything from the screen.
      void unbindService()
      unbind service
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Launcher

        public Launcher​(android.content.Context context)
        This constructor will not bind the service automatically. Please call bindService() at least once before using APIs.
        Parameters:
        context - better to use Context.getApplicationContext() to prevent memory leaks
        Throws:
        java.lang.IllegalArgumentException - if context is null.
      • Launcher

        public Launcher​(android.content.Context context,
                        ServiceStatusCallback callback)
        This constructor will bind the service automatically.
        Parameters:
        context - better to use Context.getApplicationContext() to prevent memory leaks
        callback - used to get the notification when service is ready.
        Throws:
        java.lang.IllegalArgumentException - if context or callback is null.
        See Also:
        ServiceStatusCallback
    • Method Detail

      • addWidget

        public boolean addWidget​(java.lang.String packageName,
                                 java.lang.String className,
                                 int screen,
                                 int x,
                                 int y,
                                 int spanX,
                                 int spanY)
        Add app widget to the screen.
        Parameters:
        packageName - App package name
        className - App class name
        screen - Launcher page starts from 0
        x - Widget column position
        y - Widget row position
        spanX - Widget size for column
        spanY - Widget size for row
        Returns:
        false if remote fail.
      • addAppShortcut

        public boolean addAppShortcut​(java.lang.String packageName,
                                      java.lang.String className,
                                      java.lang.String title,
                                      int screen,
                                      int x,
                                      int y)
        Add app shortcut to the screen.
        Parameters:
        packageName - App package name
        className - App class name
        title - App title or label
        screen - Launcher page starts from 0
        x - Shortcut column position
        y - Shortcut row position
        Returns:
        false if remote fail.
      • addOnHotseat

        public boolean addOnHotseat​(java.lang.String packageName,
                                    java.lang.String className,
                                    java.lang.String title,
                                    int x)
        Add app to the hotseat
        Parameters:
        packageName - App package name
        className - App package name
        title - App title or label
        x - Hotseat position which starts from 0
        Returns:
        false if remote fail.
      • removeAll

        public boolean removeAll()
        Remove everything from the screen.
        Returns:
        false if remote fail.
      • remove

        public boolean remove​(java.lang.String name)
        Remove app shortcut.
        Parameters:
        name - App title or label name
        Returns:
        false if remote fail.
      • remove

        public boolean remove​(java.lang.String packageName,
                              java.lang.String className)
        Remove app shortcut.
        Parameters:
        packageName - package name
        className - class name
        Returns:
        false if remote fail.
      • remove

        public boolean remove​(long id)
        Remove app shortcut.
        Parameters:
        id - App shortcut id
        Returns:
        false if remote fail.
      • isServiceReady

        public boolean isServiceReady()
        Check if service is ready.
        Returns:
        true if ready; false otherwise.