com.innovaphone.notificationhandler

The com.innovaphone.notificationhandler is used to communicate with the launcher itself and handles callbacks from com.innovaphone.launcher.

provideApi

The client provideApi function is used to access the Api:

var notificationHandlerApi = start.provideApi("com.innovaphone.notificationhandler");

LocalNotification

LocalNotification

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

notificationHandlerApi.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.
        }
    }
});

Parameters

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

Announce the Api

Announce the Api
For C++ App take a look into C++ AppWebsocket
For Javascript Generic take a look into Javascript config.json

Example

Example

Announce com.innovaphone.notificationhandler in your App. For example in Generic Javascript App via config.json


    "apis": {
            "vendor-yourappname": {
                "com.innovaphone.notificationhandler": {
            "info": {}
            }
        }
    }

This example shows how to use com.innovaphone.notificationhandler with com.innovaphone.launcher on clientside Framework.


    var notificationHandlerApi = start.provideApi("com.innovaphone.notificationhandler");

    notificationHandlerApi.onmessage.attach(function (sender, obj) {
        if (obj.msg.mt == "LocalNotificationClicked") {
            console.log(obj);
        }
    });


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

    var call = {};
    call.dn = "Max Muster";
    call.uri = "maxmuster@domain.de";
    call.e164 = "1234560";
    call.id = 1;

    var title = "Call by " + (call.dn || call.uri || call.e164 || "Unknown");

    dis.send({ mt: "AddLocalNotification", src: "ApiTester", title: title, text: "This is a test", acceptTitle: "Annehmen", rejectTitle: "Ablehnen" }, "*", call.id.toString());