notification

This module provides notification bar message monitoring functionality for Android devices within the Total Control environment.
It allows scripts to capture, filter, and respond to system or app-level notification messages in real time.

Key Features:

  • Create Notification objects to monitor messages by device, app, and content pattern.
  • Support both batch polling (getNotification()) and real-time listener (setListener()).
  • Support regex pattern matching and wildcard (tcConst.Any) for flexible filtering.
  • Retrieve matched notifications including app name, content, and device source.
  • Fully controllable with reset() and deleteListener() to manage message flow and memory.

Usage Scenarios:

  • Capture incoming notifications from specific apps like WeChat, WhatsApp, etc.
  • Automatically trigger actions on receiving certain messages.
  • Monitor all messages across all devices for debugging or logging.

Basic Usage:

  1. Enable TC notification listener service in the Total Control mobile client:
    • Open Total Control app on the phone
    • Go to Settings → Message Settings → Enable TC Notification Listener Service
  2. Create a Notification object:
    var { Notification } = require("sigma/notification");
    var notify = new Notification(tcConst.Any, "com.tencent.mm", "payment received");
    
  3. Retrieve notifications:
    var logs = notify.getNotification();
    
  4. Register a listener:
    notify.setListener(function(dev, app, msg) {
      print(app + ": " + msg);
    });
    

This module attaches all methods to the Notification class and supports dynamic parameter binding and monitoring behavior.

Classes

Notification