Logo Logo en
  • iRidi Pro
    Основные компоненты
    • Приложение i3 Pro
    • iRidi Pro Server
    • iRidi Studio
    • iRidium studio v. 1.3.8 (устаревшая версия)
    Java Script в iRidi
    • Руководство
    • Справочник
    • Примеры
    • JS драйвера
    другие
    • Личный Кабинет
    • iRidium Cloud
    • iRidium Transfer
    • Push-уведомления
    • Лучшая практика
    Лицензирование
    • Лицензирование и передача проекта
    • Оффлайн-лицензирование
    • Активация iRidi Pro Server
  • Продукты
    i3 lite
    • Приложение i3 lite
    • Регистрация и лицензирование
    • Сервер
    • Модули
    KNX Home Server
    • Приложение i3 KNX
    • KNX Home Server
    BUS77 HOME SERVER
    • Приложения Bus77 Home и Bus77 Lite
    • Bus77 Home Server
    Решения
    • BYOD - решение для гостиниц
    • Портал жителя - решение для МКД
    iRidi SCADA
    • iRidi SCADA
  • Bus77
    НАСТРОЙКА BUS77
    • Основы Bus77
    • Приложения Bus77 Home и Bus77 Lite
    • Работа с драйвером Bus77 в iRidi Studio
    • Настройка шины Bus77 в iRidi Studio
    ПРОТОКОЛ BUS77
    • Характеристики CAN (Bus77)
    • Описание протокола
    • Исходники на GitHub
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
  • Поддерживаемое оборудование
    Драйверы
    • Список драйверов
    • ProAV драйвера
    • AV & Custom Systems
    • JS драйвера
    • Сторонние драйвера и фриланс
    Протоколы и интерфейсы
    • Голосовое управление
    • 1-Wire
    • BACnet IP
    • Bus77
    • KNX
    • KNX IP BAOS
    • Weinzierl kBerry
    • Microsoft Exchange
    • Modbus
    • MQTT
    • NFC
    • ODBC
    • Onvif
    • SIP
    • SNMP
    • Wake On Lan
    • Z-Wave
    • ZigBee
    Производители
    • AMX
    • AVCiT
    • Beckhoff ADS
    • Biamp Tesira
    • Bluesound
    • Casambi
    • BSS Harman
    • Clipsal
    • ControlArt 7Port
    • Crestron
    • DigiBird
    • Domintell
    • Duotecno
    • EIDE
    • EPSNET
    • Global Cache
    • HDL Buspro
    • Helvar
    • IEAST
    • INELS BUS
    • INELS Wireless
    • Intesis
    • Kleger
    • Kramer VIA
    • Kramer 3000
    • Larnitech
    • Legrand Netatmo
    • LG TV
    • Lutron
    • Lutron Homeworks QS
    • MyHome
    • Nest
    • Novastar
    • Panasоnic PTZ
    • Philips Dynalite
    • PJLink
    • Satel
    • SamsungTV
    • Sonos
    • Somfy
    • SpinetiX
    • Televic Conference
    • TIS
    • Tion
    • URRI
    • Velbus
    • Velocio
    • Vinteo
    • WyreStorm
    • WiiM
    • Xicato
    • Yamaha
    • ZONT
    • Z-Wave.me
    Протестированное оборудование
    • Панель HDL S57
    • Панель HDL S10
    • SIP-домофон
    • Akuvox
    • Arlight
    • Divus
    • QBic TD-1050 PRO
    • QBic TD-1060 Slim
    • QBic TD-1070
    • Sigur
    • Uni-Ubi
    • Velocio
  • Оборудование iRidi

    Серверы
    • HS Сервер
    • ProAV Control Processor Basic
    • ProAV Control Processor Advanced
    • Спецификация контроллеров UMC
    • Настройка контроллера UMC C2
    • Настройка контроллера UMC C3
    • Настройка контроллера HDL IntelliCenter 2 (UMC C4)
    Модули расширения
    • I-PX-RS1
    • I-PX-RS4
    • I-PX-IR3
    KNX
    • KNX Home Server
    • KNX IP Interface
    Панели управления
    • iRidium Panel 7
    • Touch Panel P3
    • Touch Panel P6
    • Touch Panel P8
    • Touch Panel P10
    • Tabletop Touch Panel 10
    • AV Remote Control
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
    • Differences
iRidium mobile web-site
Содержание
    Инструменты‌
    • Сведения о странице
    • Постоянная ссылка
    • Версия для печати
    • Спецстраницы
    • Связанные правки
    • Ссылки сюда
    Login / Create Account
    Материал из for iRidium developers
    Перейти к: навигация, поиск
    Эта страница является переводом страницы Push API. Перевод выполнен на 100%.

    Other languages:
    English • ‎русский
  • Handbook
  • Push notifications
  • Содержание

    • 1 iRidium API. Push notifications
    • 2 Methods
      • 2.1 IR.SendPush
        • 2.1.1 Groups of Devices
        • 2.1.2 Function for Processing of the Push Status
    • 3 Events
      • 3.1 IR.EVENT_RECEIVE_PUSH_NOTIFY

    iRidium API. Push notifications

    methods for sending Push notifications to iOS and Android devices

    read the instruction

    see the video-instruction

    download the example


    Methods

    IR.SendPush

    Only for iRidium Server! Send Push notifications to the group of control panels

    Syntax

    IR.SendPush(title, js_data, group_id, [status_callback], [this_ptr], [sound_type]);

    input value description
    title "text of notify" type: string
    the notification text
    js_data "data" type: string, JSON
    data for sending to scripts of the application client that received the notification
    group_id 1 type: number
    identifier of the group of devices that will receive the notification. The groups have to be set up in your account on the website, the "Users & Panels" tab
    status_callback status type: function
    the processing function of the Push status. On input the function receives the object that stores the code and text description of the result of sending the Push notification
    this_ptr this type: this
    a pointer to the environment, it will be available in status_callback like this
    sound_type 0 type: number
    the type of sound that will be called on receive of Push notification. 0 - short sound (by default), 1 - long sound
    output

    -


    Sample

    // simple Push (send a text)
    IR.SendPush("Hello World!", "Data", 1);
     
     
    // advanced Push (with data to JS and status processing)
    function status (object) {
    	IR.Log('Status of Push: ' + object.Error + ' - ' + object.ErrorDescription);
    }
    IR.SendPush("Hello World!", "data for JS", 1, status, this, 0);

    the amount of text and data that can be sent in a Push notification is limited and depends on the device to which you send the notification (2 KB for iOS, 4 KB for Android). If the available data amount is exceeded, the method returns an error
    & и # symbols is not supported in Push messages and JS data


    Groups of Devices

    In order for control panels to get notifications they had to be placed in a group. The group is created on the website, in the "Users&Panels" tab of the cloud object settings. The group is assigned to the "user+project" combination. I.e. each project of one user can be a part of different groups and get different notifications.

    AttachPushGroup.png

    1 To assign a group to a user and project. The group will be automatically assigned to any control panel where the user authorizes and downloads the project
    2 To assign a group to a control panel by its HWID. You can remove or add Groups for separate panels

    CreateOrEditPushGroup.png

    1 To create a new group (you will use Group ID to send a Push notification)
    2 Groups that include the control panel (user and project)
    3 The groups that do not include the control panel


    Function for Processing of the Push Status

    Only for iRidium Server! It is activated each time you send a Push notification and receives the result about the sending: success or error.

    function status (object)
    {
    	IR.Log("Status of Push (Code): " + object.Error);
    	IR.Log("Status of Push (Text): " + object.ErrorDescription);
    }
    IR.SendPush("Hello World!", "Data", 1, status, this, 0);
    • object.Error - the code of an event, the result of sending a Push notification. The event code:
      • 0 (Success) - successful sending
      • 1-10 (Error) - the error code
    • object.ErrorDescription - the text description of the event


    Events

    IR.EVENT_RECEIVE_PUSH_NOTIFY

    Only for i3 pro! the handler of data received with Push notifications. It will get the notification text, data for JS and ID of the group for which the notification is intended.

    Syntax

    IR.AddListener(IR.EVENT_RECEIVE_PUSH_NOTIFY, 0, function (text, data, group) {}, [pointer]);

    input value description
    function function() {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output

    -


    Sample

    IR.AddListener(IR.EVENT_RECEIVE_PUSH_NOTIFY, 0, function(text, data, group)
    {
          IR.Log("EVENT_RECEIVE_PUSH_NOTIFY:" + text + " data:" + data + " group:" + group);
     
          if(data == "do the action")
          { 
                IR.Log("Ok I do"); 
          }         
          if(data.indexOf("{") == 0)
          {
             var obj = JSON.Parse(data);
             if(typeof(obj) != "undefined")
             {
                IR.Log("Json:OK");
                IR.Log(JSON.Stringify(obj));
             }
          }
    });




    Источник — «https://dev.iridi.com/index.php?title=Push_API/en&oldid=44112»
    About us
    Company
    Team
    History
    Philosophy
    Rewards
    Partnership
    Our partner
    Partnership Programs
    Apply for partnership
    products
    iRidium pro
    iRidium lite
    iRidium gate
    iRidium server
    Loads
    iRidium pro
    iRidium lite
    Other version
    Marketing materials
    Support
    On-line courses/Video
    Recommended equipment
    Other version
    iRidium pro
    Documentation
    FAQ
    Forum
    iRidium lite
    Documentation
    Forum
    Projects
    Standart projects
    Smart buildings
    Smart house
    Special solution
    Find a dealer
    News
    Youtube
    Twitter
    VK
    Logo
    contact@iridi.com
    +7 (499) 322-73-29

    Privacy policy