This example saves the notification bar message on all phones to tmp/notification.txt in the current directory.
/*
* version : 6.2.0.2886
* resolution : 720*1280
* description :Save the notification bar message on all phones to tmp/notification.txt in the current directory.
*/
define("version", "6.2.0.2886");
define("resolution", "720*1280");
define('verbose',2)
define("requireVersion", "1.5.0.2865");
function printArrayObjects(y) {
var cont = "";
for (var i = 0; i < y.length; ++i) {
var line = "";
for (var j in y[i]) {
if (j == "device") {
ct = y[i][j].getName();
} else {
ct = y[i][j];
}
line += (line == "" ? "" : ", ") + j + ":" + ct;
}
cont += "[" + i + "]: { " + line + " }\n";
}
return cont;
}
var file = "/tmp/notifications.txt"
var fs = require('fs');
var ntfn = new Notification(sigmaConst.ANY, sigmaConst.ANY, sigmaConst.ANY);
var gn = ntfn.getNotification();
var cont = printArrayObjects(gn);
try {
fs.write(file, cont, {binary:false});
print("File \"" + file + "\" saved.");
} catch (e) {
print("Error: " + e);
}