public final class PiglerAPI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DiscreetPopupConfirmationTone
Popup plays the confirmation tone
|
static int |
DiscreetPopupDurationLong
Popup's duration is long (default is short)
|
static int |
DiscreetPopupErrorTone
Popup plays the error tone
|
static int |
DiscreetPopupLightsOn
Popup switches the device light on
|
static int |
DiscreetPopupWarningTone
Popup plays the warning tone
|
Constructor and Description |
---|
PiglerAPI()
Creates API instance
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes API connection
|
int |
createNotification(java.lang.String title,
java.lang.String text,
javax.microedition.lcdui.Image icon,
boolean removeOnTap)
Creates notification
|
int |
getAPIVersion()
Gets API version of installed plugin
|
java.lang.String |
getAppName() |
int |
getGlobalNotificationsCount() |
int |
getIconSize() |
int |
getLastTappedNotification() |
int |
getMaxNotificationsCount() |
int |
getNotificationsCount() |
int |
init()
Initializes API connection
|
int |
init(java.lang.String appName)
Initializes API connection with specified app name
|
boolean |
isSingleLine()
Check if platform supports only one row of text
|
int |
removeAllNotifications()
Removes all notifications created by this app or session
|
void |
removeNotification(int uid)
Removes notification
|
void |
setLaunchAppOnTap(int uid,
boolean launch)
Marks that app needs to be launched on notification tap.
By default it's true |
void |
setListener(IPiglerTapHandler listener)
Sets notification tap handler for this app
|
void |
setRemoveNotificationOnTap(int uid,
boolean remove)
Marks that notification needs to be removed on tap.
By default it's true |
void |
showGlobalPopup(java.lang.String title,
java.lang.String text,
int flags)
Shows global popup
|
void |
updateNotification(int uid,
javax.microedition.lcdui.Image icon)
Updates notification icon
|
void |
updateNotification(int uid,
java.lang.String title,
java.lang.String text)
Updates notification text
|
void |
updateNotification(int uid,
java.lang.String title,
java.lang.String text,
javax.microedition.lcdui.Image icon)
Updates notification
|
public static final int DiscreetPopupDurationLong
public static final int DiscreetPopupLightsOn
public static final int DiscreetPopupConfirmationTone
public static final int DiscreetPopupWarningTone
public static final int DiscreetPopupErrorTone
public int init() throws java.lang.Exception
java.lang.IllegalStateException
- If already initializedPiglerException
- If initialization failedjava.lang.Exception
init(String)
,
close()
public int init(java.lang.String appName) throws java.lang.Exception
appName
- App namejava.lang.IllegalStateException
- If already initializedPiglerException
- If initialization failedjava.lang.Exception
close()
public int getAPIVersion() throws java.lang.Exception
java.lang.IllegalStateException
- If connection not initialized or closedPiglerException
- -18 If connection is not readyjava.lang.Exception
public int createNotification(java.lang.String title, java.lang.String text, javax.microedition.lcdui.Image icon, boolean removeOnTap) throws java.lang.Exception
title
- Title texttext
- Bottom texticon
- Icon, see getIconSize()
removeOnTap
- Remove on tappedjava.lang.IllegalStateException
- If connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- If creation is failedjava.lang.Exception
updateNotification(int, String, String, Image)
,
setRemoveNotificationOnTap(int, boolean)
,
updateNotification(int, Image)
,
getIconSize()
public void updateNotification(int uid, java.lang.String title, java.lang.String text, javax.microedition.lcdui.Image icon) throws java.lang.Exception
uid
- Notification idtitle
- Title texttext
- Bottom texticon
- Icon, see getIconSize()
java.lang.IllegalStateException
- if connection not initialized or closedjava.lang.IllegalArgumentException
- If notification id is wrongPiglerException
- If connection is not readyPiglerException
- If update is failedjava.lang.Exception
updateNotification(int, String, String)
,
updateNotification(int, Image)
,
getIconSize()
public void updateNotification(int uid, java.lang.String title, java.lang.String text) throws java.lang.Exception
uid
- Notification idtitle
- Title texttext
- Bottom textjava.lang.IllegalStateException
- if connection not initialized or closedjava.lang.IllegalArgumentException
- If notification id is wrongPiglerException
- -18 If connection is not readyPiglerException
- If update is failedjava.lang.Exception
public void updateNotification(int uid, javax.microedition.lcdui.Image icon) throws java.lang.Exception
uid
- Notification idicon
- Icon, see getIconSize()
java.lang.IllegalStateException
- if connection not initialized or closedjava.lang.IllegalArgumentException
- If notification id is wrongPiglerException
- -18 If connection is not readyPiglerException
- If update is failedjava.lang.Exception
getIconSize()
public void removeNotification(int uid) throws java.lang.Exception
uid
- Notification idjava.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- If remove is failedjava.lang.Exception
public int removeAllNotifications()
java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readypublic int getLastTappedNotification()
java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readypublic void setRemoveNotificationOnTap(int uid, boolean remove) throws java.lang.Exception
uid
- Notification idremove
- java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- If update is failedjava.lang.Exception
public void setLaunchAppOnTap(int uid, boolean launch) throws java.lang.Exception
uid
- Notification idlaunch
- java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- If update is failedjava.lang.Exception
public void setListener(IPiglerTapHandler listener)
listener
- Tap handlerpublic void close()
public java.lang.String getAppName()
public int getMaxNotificationsCount()
Depends on platform
public int getNotificationsCount() throws java.lang.Exception
java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- -5 If function is not supportedjava.lang.Exception
public int getGlobalNotificationsCount() throws java.lang.Exception
java.lang.IllegalStateException
- if connection not initialized or closedPiglerException
- -18 If connection is not readyPiglerException
- -5 If function is not supportedjava.lang.Exception
public boolean isSingleLine()
public int getIconSize()
public void showGlobalPopup(java.lang.String title, java.lang.String text, int flags)
title
- Titletext
- Text, may be nullflags
- Popup flagsDiscreetPopupDurationLong
,
DiscreetPopupLightsOn
,
DiscreetPopupConfirmationTone
,
DiscreetPopupWarningTone
,
DiscreetPopupErrorTone