com.innovaphone.launcher

The com.innovaphone.launcher api enables apps to communicate with the launcher itself, e.g. to send notifications etc.

consumeApi

The client consumeApi function is used to access the Api:

var dis = start.consumeApi("com.innovaphone.launcher")

Messages

AddLocalNotification
LocalNotificationClicked callback
RemoveLocalNotification

AddLocalNotification

Adds a notification, which will be opened by the corresponding launcher. You can receive user actions on this notification!

var title = "Call by " + (call.getDN() || call.getURI() || call.getE164() || str.anonymous);
var largeIcon = call.getURI() ? self.avatarApi.url(call.getURI(), "240", call.getDN()) : null;
launcherApi.send({ mt: "AddLocalNotification", title: title, text: null, acceptTitle: str.connect, rejectTitle: str.reject, largeIcon: largeIcon }, "*", call.id().toString());

Parameters

string src A unique src for this notification. This src is also used to remove the notification later.
string type The type of the notification ("Default", "PhoneCall" or "ChatMessage").
string title The title of the notification.
string text The text of the notification (e.g. chat message).
string smallIcon A smallIcon of the notification.
string largeIcon A largeIcon of the notification (e.g. a URL to a profile picture).
string soundUrl A URL with a sound file to play. It can be set to "*" to play a default sound.
string buttonTitle The button title for a one button notification or a third "view" button in a call notification.
string acceptTitle The accept button title for a call notification.
string rejectTitle The reject button title for a call notification.
string replyTitle The reply button title for a chat notification.

Remarks

Basically you can establish five kinds of notifications with the *Title parameters:
chat notificationtype:"ChatMessage", set replyTitle
call notificationtype:"PhoneCall", set rejectTitle and acceptTitle (buttonTitle optional)
one button notificationtype:"Default", set buttonTitle
two button notificationtype:"Default", set rejectTitle and acceptTitle
no button notificationtype:"Default", do not set any *Title

LocalNotificationClicked callback

This callback is triggered through the api on user interaction with the notification.

launcherApi.onmessage.attach(function (consumer, obj) {
    if (obj.msg.mt == "LocalNotificationClicked") {
        if (obj.msg.action == "accept") {       // accepted        
        }
        else if (obj.msg.action == "reject") {  // rejected            
        }
        else if (obj.msg.action == "reply") {   // reply with input
            // obj.msg.replyText contains the text
        }
        else {                                  // default action, e.g. open the current chat/call/etc.
        }
        self.BringToFront();
    }
});

Parameters

string src The src for this notification.
string action Can be empty or accept|reject|reply.
string replyText The reply text.

RemoveLocalNotification

Removes an existing notification.

launcherApi.send({ mt: "RemoveLocalNotification" }, "*", call.id().toString());

Parameters

string src The original src of the notification.