en Translate

menu

Providing governments around the world the ability to quickly and effectively reach their citizens and visitors with time-sensitive important messages.

Integrating In-telligent’s technology into your existing applications will ensure that your important messages are noticed immediately.

Using our app means you don’t need to have an app to make effective emergency communication possible.

Creating peace of mind by knowing that the important people in your life can get your attention when something urgent and unexpected happens.

Ensuring relevant people are alerted immediately during time-sensitive situations with patented technology. 

Blogging

Read the latest news from In-telligent and see how our technology is making a difference for people and organizations around the world.

Our team works passionately to create the most powerful emergency communication platform possible, with the goal of keeping everyone everywhere safer during times of crisis.

Find answers to common questions or talk to us about how In-telligent technology can enhance your time-sensitive communication efforts.

API Documentation

Last updated July 20, 2021

Open API framework for In-telligent integration.

1. PURPOSE

This document is to provide guidance on how to integrate In-Telligent’s Open API Library (Framework) with your Android and iOS mobile applications. The Open API library has 3 features:
DND Override feature will override the DND on the targeted device (iOS and Android) and raises the alarms / alerts for the following scenarios:
  1. Device is in DND Mode
  2. Device is in Silent Mode
  3. Device is in DND Mode and manually silenced
  4. Device is in DND Mode and the App is in idle state
  5. Device is in DND Mode and the App is in killed state
  6. Device is in DND Mode and the App is running in background
  7. Device is in DND Mode and the App is running in foreground mode
  8. Device is in DND Mode and Flight mode, and WIFI is enabled

Also known as Auto Grouping. This feature allows the device to automatically subscribe to all the nearest In-telligent communities. This service will run in the background and automatically subscribes to nearest communities in following scenarios:

a. When the app is in background state

b. When the app is in foreground state

c. When the app is in killed state

    The alert notification can be translated into a different language for better reading in a comfortable language.

    2. REQUIREMENTS (DEVELOPMENT ENVIRONMENT)

    Android:

    •  Android Studio
    •  Android Mobile Version 8.0 and above
    • Open API library file *
    • Partner Token
    • Google account
    • Server-side implementation – (App Owner’s server)                 
      • Ensure the App Owner’s server API implementation is utilizing Google firebase as described in the following link:
    https://firebase.google.com/ docs/cloud-messaging/server
    • The notification payload should be created as per sample listed in Section 6 Server-side implementation

    iOS

    •  Xcode 12 above
    • iOS Mobile Version 12.0 and above
    • Open API library file *
    • Partner Token
    • Apple developer account
    • Server-side implementation – 
      • Ensure the App Owner’s server API implementation is ready to send notification payload as per the sample listed in section 6
    * Supplied by In-telligent

    3. ABOUT THE FRAMEWORK

    The In-telligent Open API framework supports the integration of In-telligent proprietary code into any mobile application. Features include customer authentication, sending push notifications to subscribed users, automatically grouping users into “communities” based on real-time location and translation of text into any supported language.

    This feature overrides a mobile device’s DND and silent mode features in order to force an audible alert to that device.

    This feature allows the device to automatically subscribe to all the nearest in-telligent communities. This application will run in the background and listen for the device location change events and auto-subscribe or un-subscribe to respective communities.

    The Auto-subscribe functionality triggers in two scenarios:

      1. User moves away from Geo-fence range: Open API will un-subscribe the user from community
      2. User comes into a Geo-fence range: Open API will subscribe the user to the community.

    This feature translates the alert message to any available language. 

    Note: List of languages will be coming from the In-telligent (Refer section 5.5).

    4. INTEGRATION STEPS

    The following describes the required Android and iOS integration dependencies for the OpenAPI library.

    a. Open the Android Studio project.

    b. File  New  New Module  Select “import *.JAR / *.AAR package” and navigate to the location of the Open API library and import as a Module

    c. Make sure this framework is added in the application folder structure.

    d. Add the following dependency as library: (project: build.gradle file dependencies section)     classpath “io.realm:realm-gradle-plugin:10.0.0

    e. Add the following dependencies as plugin: (app: build.gradle file):

          apply plugin: ‘realm-android’

    f. Add the following dependencies as libraries: (app: build.gradle file dependencies section):

     

        implementation fileTree(dir: ‘libs’, include: [‘*.jar’])

       implementation ‘com.google.firebase:firebase-messaging:22.0.0’

        implementation ‘androidx.appcompat:appcompat:1.3.0’
        implementation ‘com.github.mrmike:ok2curl:0.4.5’

        //reactive
        implementation ‘io.reactivex.rxjava2:rxjava:2.2.21’
        implementation ‘io.reactivex.rxjava2:rxandroid:2.1.1’

       implementation ‘com.squareup.retrofit2:adapter-rxjava2:2.9.0”
        implementation ‘com.squareup.retrofit2:converter-gson:2.9.0’
         implementation ‘com.google.android.gms:play-services-location:18.1.0’
        implementation ‘androidx.localbroadcastmanager:localbroadcastmanager:1.0.0’
    //For Work Manager
        implementation ‘androidx.work:work-runtime:2.5.0’
        implementation project (path: ‘:openapi-release-v5.0’)

     g. Add the logo property to the application tag and assign the path of the icon for notification in AndroidManifest.xml. Example:

    <application

    android:logo=”@mipmap/ic_launcher_round

    >

    h. Add following code to onCreate() method of application class:

    RxJavaPlugins.setErrorHandler(throwable -> PrintLog.print(“Rx Error”,throwable));
    1. Open the XCode project in which you would like to integrate this framework.
    2. Drag and drop “OpenAPI.framework” into the bundle folder.
    3. Make sure this framework is added in both “Embedded Binaries” and “Linked Framework and libraries”
    4. Import the following third-party dependency libraries: 
      • Alamofire (~> 4.0)
      • SwiftyJSON
      • RealmSwift
      • DeviceGuru
    1. Install the above dependency frameworks by using cocoa pods.

    Ref: https://guides.cocoapods.org/using/
    getting-started.html

    1. To generate the build please follow below steps
    1. Select Project Target > Edit Scheme > Archive > Pre-Actions
    2. Add Script
    3. Provide build settings from – Select the App Target
    4. Add the below Script

      FRAMEWORK=”OpenAPI”

      FRAMEWORK_EXECUTABLE_PATH=”${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK”

      EXTRACTED_ARCHS=()

      for ARCH in $ARCHS

      do

      lipo -extract “$ARCH” “$FRAMEWORK_EXECUTABLE_PATH” -o “$FRAMEWORK_EXECUTABLE_PATH-$ARCH”

      EXTRACTED_ARCHS+=(“$FRAMEWORK_EXECUTABLE_PATH-$ARCH”)

      done

      lipo -o “$FRAMEWORK_EXECUTABLE_PATH-merged” -create “${EXTRACTED_ARCHS[@]}”

      rm “${EXTRACTED_ARCHS[@]}”

      rm “$FRAMEWORK_EXECUTABLE_PATH”

      mv “$FRAMEWORK_EXECUTABLE_PATH-merged” “$FRAMEWORK_EXECUTABLE_PATH”

    5. FEATURE SPECIFIC INSTRUCTIONS

    1.  
    1. Add the Google Services plugin as the last entry in your app level build.gradle file:

    apply plugin: ‘com.google.gms.google-services’  // Google Play services Gradle plugin // Step

    1. Add google services plugin to root level build.gradle file as below

    dependencies {
    classpath ‘com.google.gms:google-services:4.3.8’
    // …
    }

    1. Add Firebase to your project as described in the following link:

    https://firebase.google.com/docs/cloud-messaging/android/client

    1. Download google-services.json file (from firebase) and place in the app folder of the project structure.
    2. Note down the firebase project server key from the project created in Firebase console. (Project settings  Cloud Messaging  Server Key).

    Note: This server key is used in later steps to send notification from Server / rest client

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-Telligent.

    There are 2 methods in helping the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache.

    Parameters

     partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber, userName,

    password, partnerToken, Gender.FEMALE, new Consumer()

    {
    @Override
    public void accept(Boolean status) {
    if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here
    } else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1. The following steps need to be added to the Application class and performed one time on initial launch of the mobile application:
    1. Initialize Open API         
      Make a call to
      OpenAPI.init() method from Open API as described below
    2. Setup configuration

    OpenAPI.Configuration configuration = new OpenAPI.Configuration.Builder()


    .setAppVersion(BuildConfig.VERSION_CODE).setDebug(true)

    .setEnvironment(Environment.RELEASE)
    .setHeadsUpNotificationActionReceiver(new CallReceiver()).

    build();
    OpenAPI.init(getApplicationContext(), configuration);

    Below is the callback receiver and call actions in the application receiver from the library.

    public class CallReceiver extends HeadsUpNotificationActionReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    if (intent != null && intent.getExtras() != null) {
    String action = intent.getAction();
    PushNotification data = (PushNotification) intent.getSerializableExtra(Actions.CALL_NOTIFICATION);
    NotificationManager notificationManager = (NotificationManager)context.
    getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(Integer.parseInt(data.getNotificationModel().getId()));
    OpenAPI.getInstance().getAudioHelper().stopRingtone();
    if (action != null) {if (action.equals(Actions.ACTION_MARK_AS_READ) && data != null) {
    PrintLog.print(“CallReceiver”, “Mark as Read action”);
    OpenAPI.alertOpened(Integer.parseInt(data.getNotificationModel().getId()), successResponse -> {
    if (successResponse != null && successResponse.isSuccess()) {
    Toast.makeText(context, “Alert open success”), Toast.LENGTH_LONG).show();
    } else if (successResponse != null) {
    Toast.makeText(context, successResponse.getError(), Toast.LENGTH_LONG).show();
    } else {
    Toast.makeText(context, “Alert open failed”, Toast.LENGTH_LONG).show();
    }
    });} else if (action.equals(Actions.ACTION_DELETE)) {
    PrintLog.print(“CallReceiver”, “Delete action”);
    OpenAPI.deleteAlert(Integer.parseInt(data.getNotificationModel().getId()), successResponse -> {
    if (successResponse != null && successResponse.isSuccess()) {
    Toast.makeText(context, context.getString(R.string.alert_delete_success), Toast.LENGTH_LONG).show();
    } else if (successResponse != null) {
    Toast.makeText(context, successResponse.getError(), Toast.LENGTH_LONG).show();
    } else {
    Toast.makeText(context, “Delete alert failed”, Toast.LENGTH_LONG).show();
    }
    });} else if (action.equals(Actions.ACTION_OPEN)) {
    PrintLog.print(“CallReceiver”, “Open action”);}
    }
    1. By default, OpenAPI library would be connecting to Production servers. Environment.RELEASE is the default configuration. You can change to Environment.DEV, to switch between Prod and Dev servers.

    OpenAPI.getInstance().authorization(email, mobileNumber, userName,

    password, partnerToken, Gender.FEMALE, new Consumer()

    OpenAPI.Configuration configuration = new OpenAPI.Configuration.Builder()
    .setAppVersion(BuildConfig.VERSION_CODE).setDebug(true). .setEnvironment(Environment. DEV)
    .setHeadsUpNotificationActionReceiver(new CallReceiver())..build();
    OpenAPI.init(getApplicationContext(), configuration);

    1. Generate Device Token as described in the Firebase SDK link provided above
    2. This token is required to pass on to in-telligent servers to send push notifications to the device. Below code snippet shows how to send the FCM device token to Server.
    OpenAPI.getInstance().registerPushToken((token,new Consumer() {
    @Override
    public void accept(Boolean status) {
    if (status)
    PrintLog.print(TAG, “Device Token Sent to server”);
    else
    PrintLog.print(TAG, “Failed to send. Please try again later.”);
    }
    });
    1. Enable additional DND permission –

    Some devices have additional DND settings to prevent the alert sounds. To handle the alerts in such devices, we need to request DND additional permission from user. If we enable the permission, the OpenAPI library will turn off the device DND for 60seconds to play sound and then turns off the DND again (automatic).

    Make a call to the below method in the home activity to request this special permission. Without this permission also the app will work (make audible sound) in all the devices where DND additional settings are not manually enabled.

    DND additional settings are not manually enabled.

    OpenAPI.checkDNDPermission(this);
    1. Add the following permissions to the Manifest file (AndroidManifest.xml)

    <uses-permission android:name=”android.permission.FLASHLIGHT” />
    <uses-permission android:name=”android.permission.VIBRATE” />

    <uses-permission android:name=”android.permission.INTERNET” />

    <uses-permission android:name=”android.permission.MODIFY_AUDIO_SETTINGS” />

    1. Add the following service to the Manifest file within tag

    <service android:name=”.FCMService”>
        <intent-filter>
            <action android:name=”com.google.firebase.MESSAGING_EVENT” />
        </intent-filter>
    </service>

    1. Setup the required Firebase methods as detailed in the following link:  

    https://firebase.google.com/docs/cloud-messaging/android/receive

    1. Override the onReceiveMessage method to receive the message payload and call below “relayPushNotification” method with message payload in the onReceiveMessage of FirebaseService. 
    OpenAPI.getInstance().relayPushNotification(remoteMessage.getData(), this);

    Note: The notification will have three button option – 

        1. Mark As Read
        2. Delete
        3. Open

    The variations are – 

    1. In some devices these buttons will be visible by default.
    2. In some devices we need to expand notification to see the buttons.

     The notification is in expandable form with following variations –

    1. In some devices notification is expanded by default.
    2. In some devices there will be arrow to expand.
    3. In some devices on dragging down notification will expand.
    1. In the project target folder 🡪 Capabilities 🡪 background modes enable the following:
    • Audio, Airplay, and Picture in Picture
    • Location updates
    • Voice over IP
    • Background fetch
    • Remote notifications
    1. In Capabilities, enable Push notifications.
    2. Register the application with the bundle identifier in apple developer website (https://developer.apple.com/) and enable VOIP services on the apple developer portal with the app ID and then create:
      1. Certificates: (Refer to the attached document – iOS Certificates creation process)
      2. Profiles: (Refer to the attached document – iOS Certificates creation process)
      3. Integrate: Install certificates by double clicking on the certificates. This is to run the development application in iPhone physical device and to send push notification usingPusher client.

    Ref: (attached document – iOS Certificates creation process)

    Download File

    1. For VOIP services, 
    • Generate a P8 file in KEYS section in developer portal (Ref: attached document – iOS Certificates creation process)
    • Download the generated file
    • Integrate the above certificates with backend web services, which will initiate the notification (app owner’s server)
    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-Telligent.

    There are 2 methods in helping the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    OpenAPI.authorization(

    partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username,

    gender: .male){status in

    if status {

    //login sucess

    }

    else{

    //something went wrong

    }

    }

    }

            1. For further use, need to capture device tokens from the following delegates methods
    function appliction((_ applictaion:UIApplictaion,didRegisterForRemoteNotificationWithDeviceTokendeviceToken :Data){
    letDeviceTokenString=deviceToken.reduce(“”,{$0+String(format:”%02X”,$1)})
    print(“push token regular: /(deviceTokenString)”}func pushRegistry(_ registry:PKpushRegistry,didUpdate credentials,PKpushCredentials forType:PKpushType){

    var PToken :string=””;

    for i in 0 ..<credentials.token.count{

    pToken+=String(format:”%02.2hhx”,credentials.token[i] as CVarArg)

    }

    print(“push token voip :/(pToken)”}

            1. In Order to receive PushKit notification / Regular notification from In-telligent server, need to register captured device tokens (Regular Push token and VoIP Push token) with In-telligent using OpenAPI method “registerPushKitToken” as bellow ,

    OpenAPI. registerPushKitToken (voipPushToken: voipPushToken, regularPushToken: regularPushToken) {

    (status) in

    completion (status)

    }

            1.  When the Regular push notification payload is received on the delegate method, call the Open API method relayPushKitNotification and pass the received payload. The Open API library will handle the notification with the appropriate sound

    func application(_ application: UIApplication , didReceiveRemoteNoti fication userlnfo: [AnyHashable : Any ],

    fetchCompletionHandler completionHandler: @esca ping (UIBackgroundFetchResul t) -> Void ){

    print(userlnfo)

    OpenAPI.relayPushKitNotification(dictionaryPayload: userlnfo)

    }

            1. When the PushKit payload is received on the delegate method, call the Open API method relayPushKitNotification and pass the received payload.   The Open API library will handle the notification with the appropriate sound.

    func pushRegistry(_ registry: PKPushRegistry,

    didReceivelncomingPushWith rawPayload: PKPushPayload,

    for type: PKPushType ){

    debugPrint ( “recived push notification”\ (rawPayload.dictionaryPayload )”)

    OpenAP .relayPushKit Notification(dictionaryPayload: rawPayload.dictionaryPayload)

    }

    The auto subscription feature will subscribe or un-subscribe a device based on device location change events. Once this functionality has been invoked, every user / device will automatically update into or out of In-telligent communities when entering or leaving a Geo fence 

    To implement this functionality, the following steps must be taken.

    1. Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer() {
    @Override
    public void accept(Boolean status) {

    if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here

    }

    else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1. Auto Subscription: After authentication, the following method is used to initiate the auto subscription process: 

    OpenAPI. getSubscribedCommunities (getApplicationContext(), new Consumer() {
    @Override
    public void accept(List communities) {
    if (communities != null) {
    PrintLog.print(TAG, “SubscriberCommunities received success”);
    // Add communities to recyclerview adatpter}

    else {
    PrintLog.print(TAG, “SubscriberCommunitiesreceived failure”);
    }
    }
    });

    This will handle the following functionality:

      1. Handling location change Events:
        1. Get the device location and listen for subsequent location change events.
        2. Retrieving the Geo fence from server and automatically will add / remove Geo fence boundaries to / from the device.
      2. Get communities and Subscribe to new communities list from server.
        1. Get list of communities from In-telligent server API.
        2. Auto subscribe to the received communities from API.

    The above method is to be called after authorization and whenever app needs to start Auto-Subscription.

    1. Community lists for a subscriber: 

    After auto subscription has been invoked, handle callback method – currentSubscriberDidChange () – to get a list of all communities that a device has been auto subscribed.  The following is a code snippet for this method:  

    OpenAPI. getSubscribedCommunities (getApplicationContext(),new Consumer() {
    @Override
    public void accept(List communities) {
    if (communities != null) {
    PrintLog.print(TAG, “Subscriber Communities received success”);}

    else {
    PrintLog.print(TAG, “SubscriberCommunitiesreceived failure”);
    }
    }
    });

    1. Permissions:

    Add the following Geo Fence services to the application manifest.xml file and then handle the permission request.

    <uses-permission android:name=”android.permission.FLASHLIGHT” />
    <uses-permission android:name=”android.permission.VIBRATE” />
    <uses-permission android:name=”android.permission.INTERNET”/>
    <uses-permission android:name=”android.permission.MODIFY_AUDIO_SETTINGS” />
    <uses-permission android:name=”android.permission.RECEIVE_BOOT_COMPLETED”/>

    <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”/>

    <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />

    <uses-permission android:name=”android.permission.ACCESS_BACKGROUND_LOCATION” />

    The auto subscription feature will subscribe or un-subscribe a device based on device location change events.  Once this functionality has been invoked, every user / device will automatically update into or out of In-telligent communities when entering or leaving a Geo fence. 

    To implement this functionality, the following steps must be taken.

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. Check Token: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.authorization(

    partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username,

    gender: .male){status in

    if status {

    //login sucess

    }

    else{

    //something went wrong

    }

    }

    }

    1. Auto Subscription: After authentication, the following method is used to initiate the auto subscription process: 
    OpenAPI.start(self)

    This will handle the following functionality:

      1. Handling location change Events:
        1. Get the device location and listen for subsequent location change events.
        2. Retrieving the Geo fence from server and automatically will add / remove Geo fence boundaries to / from the device.
      2. Get communities and Subscribe to new communities list from server.
        1. Get list of communities from In-telligent server API.
        2. Auto subscribe to the received communities from API.
        3. Save received communities into device local storage (DB).

    The above method is to be called after authorization and whenever app needs to start Auto-Subscription.

    1. Community lists for a subscriber: 

    After auto subscription has been invoked, handle delegate method- subscribedCommunities( ) – to get a list of all communities that a device has been auto subscribed. The following is a code snippet for this method:

    func subscribedCommunities(_ subscribedCommunities: [INCommunity]){

    print(subscribedCommunities)
    }

    1. Permissions:

    Add the following Geo Fence services to the application manifest.xml file and then handle the permission request.

    Privacy- Camera Usage Description  $(PRODUCT_NAME)uses your camera to add attachments and handle flashlight in emergency handle .

    Privacy-Location Always and When i  use usage description $(PRODUCT_NAME) uses your location to send you location relevant messages arid to allow you to connect to the closest emergency services team when you are 1n danger.

    Privacy-Location Always   use description $(PRODUCT_NAME) uses your location to send you location relevant messages and to allow you to connect to the closest emergency services team when you are m danger.

    Privacy-Location Always and When i  use usage description  $(PRODUCT_NAME) uses your location to send you location relevant messages and to allow allow you to connect to the closest emergency services team when you are m danger.

    Privacy-Microphone Usage  $(PRODUCT_NAME) uses your microphone to make calls.

    Privacy-Photo Library usage description $(PRODUCT_NAME) uses your photos 10 add attachments.

    The language translation feature will translate community notifications from the original language to any other supported language. . 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer() {
    @Override
    public void accept(Boolean status) {if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here}

    else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1.   Building Notifications: After authentication and getting buildings the following method is used to get notifications for all buildings according to building ID.   Note : Notification doesn’t contain attachment information (refer 5.5).

    OpenAPI.getBuildingNotifications(new Consumer<HashMap<String, ArrayList>>() {

    @Override
    public void accept(HashMap<String, ArrayList> notificationsByBuilding) throws Exception {

    //Printing the Notifications with building ID
    notificationsByBuildings.entrySet().forEach(entry->{
    System.out.println(entry.getKey() + ” ” + entry.getValue());
    });
    }
    });

      1.   Notifications for a Building: After authentication and getting buildings the following method is used to get notifications for a single building according to building ID 

    Note: Notification doesn’t contain attachment information (refer 5.5).

    OpenAPI.getNotificationsByBuilding(int buildingId,new Consumer< ArrayList>() {
    @Override
    public void accept(ArrayList notificationsByBuilding) throws Exception {
    //Printing the Notifications
    for(Notification notification : notificationsByBuilding){
    System.out.println(notification);
    };
    }
    });
    1.   Notification: After authentication and getting buildings the following method is used to get complete notification data according to notification ID. 
    OpenAPI.getCompleteNotification(int notificationId,new Consumer< Notification>() {
    @Override
    public void accept(Notification notification) throws Exception {
    //Printing the Notification
    System.out.println(notification);
    }
    });
    1.   List of Languages After getting building notifications, the following method is used to get a list of languages supported for Notification translation ,OpenAPI.getLanguages()
    OpenAPI.getLanguages(new Consumer() {
    @Override
    public void accept(NotificationLanguageResponse languageResponse) throws Exception {
    System.out.println(languageResponse.getLanguages());
    }
    });
    1. Notification Translation: The method INLanguageManager.getTranslation() is used to retrieve the translated message and the title of the message.  

    Parameters: notification ID and target language.

    OpenAPI.getTranslation(id,languageValue,new Consumer() {

    @Override
    public void accept(TranslationResponse translationResponse) throws Exception {

    System.out.println(translationResponse.getBody()), System.out.println(translationResponse.getTitle());
    }
    });

    The language translation feature will translate community notifications from the original language to any other supported language. 

    To implement this functionality, the following steps must be taken.

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)

    OpenAPI.authorization(

    partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username,

    gender: .male){status in

    if status {

    //login sucess }

    else

    { //something went wrong

    }

    } }

    1. Building Notifications: After authentication and getting buildings (refer to section 5.4 point 2) the following method is used to get notifications for buildings using “building id”.OpenAPI.getBuildingNotifications()
    OpenAPI.getBuildingNotifications()
    1.  Notifications for building: After authentication and getting buildings the following method is used to get notifications for a single building according to building. ID.OpenAPI.getNotificationsByBuilding(communityId)
    self.notifications = OpenAPI .getNotificationsByBuilding(community.id)
    self.tableView.reloadData();
    1.  Notifications: After authentication and getting buildings the following method is used to get complete notification data according to notification ID.
      OpenAPI.getCompleteNotification()

    OpenAPI.getCompleteNotification(notification_id){notification in

    print(notification.description)

    }failure: error in

    print(error?.localizedDescription ?? “”)

    }

    1. List of Languages: After getting building notifications, the following method is used to get a list of languages supported for Notification translation.

    INLanguageManager.getLanguages() 

    INLanguageManager.getLanguages({[weakself] (languages) in
    print (languages)
    }){error in
    print (error? .localizedDescription ?? “”)}
    1. Notification Translation: The method INLanguageManager.getTranslation() is used to retrieve the translated message and the title of the message. 

    Parameters: notification ID and target language.

    INLanguageManager.getTranslation()

    INLanguageManager.getTranslation(for :communityNotifiaction, to :language, success :{translateNotification in
    print (translateNotification)
    }){error in
    print (error? .localizedDescription ?? “”)}

    A Community manager can initiate this API to send community alert to subscribers of his community. This will allow us to send different types of alerts (Regular, Personal, Ping, Critical, LSA) with or without attachments from the mobile app.

    To implement this functionality, the following steps must be taken.

    Note: (To become a community manager for any given community, you need to contact admin)

    Admin can add a Community Manager in In-telligent Web Portal. To register as a Manager, a valid email id / mobile number required. Once Admin adds a Community Manager for any given community, he will receive a link to set password. After setting the password, with that credentials Community Manager can login to the Mobile app.

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)

    OpenAPI.authorization(

    partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username,

    gender: .male){status in

    if status {

    //login sucess

    }

    else{

    //something went wrong

    }

    } }

    1. Send Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.sendAlert(title: alertTitle, message: alertMessage, building: buildingInformation, attachments: attachmentsInformation, notificationType: NotificationType)

    Parameters

    title – 

    Required – Yes

    Type – String

    message – 

    Required – Yes

    Type – String

    building – 

    Required – Yes

    Type – INBuilding (OpenAPI library class)

    attachments – 

    Required – Yes

    Type – Array of CustomImage (OpenAPI library class)

    notificationType – 

    Required – Yes

    Type – NotificationType (OpenAPI library class)

    OpenAPI.sendAlert(title: title_value, message: message_value, building: building, attachments: attachments, notificationType: notification_type, success: {
    // Handle success response
    }) { (error) in
    // Handle error response
    }

    A Community manager can initiate this API to send community alert to subscribers of his community. This will allow us to send different types of alerts (Regular, Personal, Ping, Critical, LSA) with or without attachments from the mobile app.

    Note: (To become a community manager for any given community, you need to contact admin)

    Admin can add a Community Manager in In-telligent Web Portal. To register as a Manager, a valid email id / mobile number required. Once Admin adds a Community Manager for any given community, he will receive a link to set password. After setting the password, with that credentials Community Manager can login to the Mobile app.

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on 

    initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer()

    {
    @Override
    public void accept(Boolean status) {

    if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here

    } else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1. Send Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    OpenAPI.sendAlert(buildingId, title, message, notificationType, attachmentPaths, new Consumer()

    {

    @Override
    public void accept(SuccessResponse successResponse) throws Exception{
    if (successResponse != null && successResponse.isSuccess()) {
    PrintLog.print(TAG, “Success”);

    }else{
    PrintLog.print(TAG, “Error”);

    }
    }
    });

    Parameters

    title – 

    Required – Yes

    Type – String

    message – 

    Required – Yes

    Type – String

    buildingID – 

    Required – Yes

                                       Type – String(To get building Id -refer to section 5.3 point 4). 

    attachments – 

    Required – optional

    Type – Array of CustomImage Paths

    notificationType – 

    Required – Yes

    Type – AlertType (OpenAPI library class)

    The delivered alert status feature will inform the server about notification being delivered to the user. It will be done without developer’s action on receiving an alert.

    The opened alert status feature will inform the server about notification being read by the user. 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer()

    {

    @Override
    public void accept(Boolean status) {

    if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here

    } else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1. Call opened alert: After authentication, the following method is used to update server about alert opened status using notification ID.

     Parameters

    notificationId – 

    Required – Yes

    Type – int

    OpenAPI.alertOpened(notificationId, new Consumer< SuccessResponse>()

    {

    @Override
    public void accept(SuccessResponse successResponse) throws Exception {

    if (successResponse != null && successResponse.isSuccess()) {
    // Opened status successfully sent to server
    } else if (successResponse != null) {
    PrintLog.print(TAG, “Opened alert failure “+ successResponse.getError());
    } else {
    PrintLog.print(TAG, “Opened alert failure “);
    }
    }
    });

    The delete alert feature will enable a user to delete an alert. 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    OpenAPI.getInstance().authorization(email, mobileNumber,

    userName, password, partnerToken, Gender.FEMALE, new Consumer()

    {

    @Override
    public void accept(Boolean status) {

    if (status) {
    PrintLog.print(TAG, “Sign in received success”);
    // register push token here

    } else {
    PrintLog.print(TAG, “Sign in received failure”);
    }
    }
    });

    1. Call delete alert: After authentication and receiving at least 1 alert, the following method is used to delete an alert using notification ID.

     Parameters

    notificationId – 

    Required – Yes

                            Type – int

    OpenAPI.deleteAlert ()

    OpenAPI.deleteAlert (notificationId, new Consumer< SuccessResponse>()

    {

    @Override
    public void accept(SuccessResponse successResponse) throws Exception {

    if (successResponse != null && successResponse.isSuccess()) {
    // Alert successfully deleted
    } else if (successResponse != null) {
    PrintLog.print(TAG, “Delete alert failure “+ successResponse.getError());
    } else {
    PrintLog.print(TAG, “Delete alert failure “);
    }
    }
    });

    The delivered alert status will inform the server about notification being delivered to the user. 

    It will be done without developer’s action on receiving an alert.

    The opened alert status feature will inform the server about notification being read by the user. 

    To implement this functionality, the following steps must be taken

    1. Configure: 

    In AppDelegate.swift file within didFinishLaunchingWithOptions method add the below

    code to configure the API setup

    #if DEBUG
    OpenAPI.setEnvironment(to: .uat)
    #else
    OpenAPI.setEnvironment(to: .prod)
    #endif
    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. Authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)

    OpenAPI.authorization( partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username, 

    gender: .male){ status in

    if status

    {

    //login sucess

    } else

    {

    //something went wrong

    }

    } }

    1. Opened Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.openedAlert(notificationId: notification_id)

    Parameters

    notificationId – 

    Required – Yes

    Type – Int

    OpenAPI.openedAlert(notificationId: aNotification.id, success:
    {
    //Handle success response
    }) { (error) in
    //Handle failure response
    }

    The delete alert feature will enable a user to delete an alert. 

    To implement this functionality, the following steps must be taken.

    1. Configure: 

    In AppDelegate.swift file within didFinishLaunchingWithOptions method add the below code to configure the setup for the API

    #if DEBUG

    OpenAPI.setEnvironment(to: .uat)

    #else

    OpenAPI.setEnvironment(to: .prod)

    #endif

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)

    OpenAPI.authorization( partnerToken:partnerToken,

    email:emailId,

    mobileNumber:mobileNumber,

    password:password,

    name:username,

    gender: .male)status in

    if status {

    //login sucess

    }

    else{

    //something went wrong

    }

    } }

    1. Delete Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.deleteAlert(notificationId: notification_id)

    Parameters

    notificationId – 

    Required – Yes

    Type – Int

    OpenAPI.deleteAlert(notificationId: notification.id, success: {

    //Handle success response

    }) { (error) in

    //Handle failure response

            }

    6. HOW TO TEST

    Using In-telligent Portal: You can use the In-telligent portal to send notifications once section 7 (below) has been fully integrated on the In-telligent servers.

    1. Launch In-telligent web portal
      1. Prod: https://app.in-telligent.com/
      2. Dev: https://app.dev.in-telligent.com/
    2. Login using valid credentials.
    3. Click on “Communities” tab from top navigation.
    4. Select community from list to send alert notification.
    5. Once community page is opened, click on “send a community alert” from left sidebar navigation.
    6. Enter required fields, select type of alert and click on send button to send to subscribed users for selected community.
    7. Alert should send to the selected/all users in community.

    Using REST client

    The following approach can be used to test third-party application functionality without interaction with the In-telligent messaging service.

    NOTE: The In-telligent messaging service can also be used for testing purposes once the third-party application has been fully integrated with the In-telligent backend services.  See section 7 below for more information.

    1. Use REST client to send notification to the device

    Download File

    • Replace the value for the “to” field with the generated device token (step 5.1), replace the value for the “key” field with the server key (noted in step 5.1) and send notification.

    Note: For actual implementation on the server (app owner server), please go through the below documentation.

    https://firebase.google.com/docs/cloud-messaging/server

    1. Print and capture the device token from Log as soon as you run the application on the device.
    2. Use this device token, the server key (noted in section 5.1) and the following payload to send the notification.
    3. Device will receive the alert and the respective sound. If the app developer wants to show the alert within the application, please capture the details from the payload and display accordingly.

    A sample notification payload should be as follows:

    {
    “data”: {
    “payload_version”:”2″,
    “building”: {
    “name”: “Test Community”,
    “id”:”12345″
    },
    “data”: {
    “title”: “test alert please ignore”,
    “body”: “test alert please ignore”
    },
    “notification”{
    “action”: “pushNotification”,
    “language”: “en”,
    “id”: “12345”,
    “type”: “normal”,
    “suffix”: “to refer back to this alert or to see more information, please open the App”
    }
    /// Any additional fields you may want
    },
    “to”: “fW40hcEO9PA:APA91bFJr2-nwkSuBfhL3_g2Q3iPZOZGcx-P6B_zVVR_7k1zMDC-qFIYcdzdNE_h2ecRO17Sw2tvcHp7xLkAArajyILRAgYolHJt8CuXo7t66TB48VoOeTdQPI-Mtq0HKjxKPXF4S_BM”
    }

    Description of the above payload parameters:

    • Payload_version: Current version is “2”
    • Building: Contains building details like name (building name) and id (building id)
    • data: Contains notification data like title (notification title) and body (notification description)
    • Notification: Contains notification parameters like action (notification type), language (notification language), id (notification id), type (alert type) and suffix.
    • Type can be one of .
      1. life_safety
      2. personal_safety
      3. critical
      4. ping
      5. weather_alert
      6. lightning_alert
      7. pc_urgent_alert
      8. pc-emergency
      9. Normal
      10. suggested
    • To: This is the Device Token generated on the Android device as soon as you run the application. This will be unique to a device. If the same app runs on a different device, the generated device token will be different.

    Using In-telligent Portal: 

    You can use the In-telligent portal to send notifications once section 7 (below) has been fully integrated on the In-telligent servers.

    1. Launch In-telligent web portal 
      1. Prod: https://app.in-telligent.com/
      2. Dev: https://app.dev.in-telligent.com/
    2. Login using valid credentials.
    3. Click on “Communities” tab from top navigation.
    4. Select community from list to send alert notification.
    5. Once community page is opened, click on “send a community alert” from left sidebar navigation.
    6. Enter required fields, select type of alert and click on send button to send to subscribed users for selected community.
    7. Alert should send to the selected/all users in community.
    8. If it is critical alert(Ping, Critical, LSA,PC LSA, Weather, Lightning), it should come with 

    VOIP call otherwise it should come with regular push notification

    Using Pusher Client

    The following approach can be used to test third-party application functionality without interaction with the In-telligent messaging service.

    NOTE: The In-telligent messaging service can also be used for testing purposes once the third-party application has been fully integrated with the In-telligent backend services.  See section 7 below for more information.

    1. Use Pusher client to send a notification to the device

    Ref: https://github.com/noodlewerk/NWPusher

    1. Print and capture the device token from Log as soon as you run the application on the device.
    2. Use this device token, select certificate related to the bundle ID and the sample payload shown below to send the notification.
    3. The device will receive the alert and the respective sound. If the app developer wants to show the alert within the application, please capture the details from the payload and display accordingly.

     Sample payload: Regular Push

    {
    “payload_version”: 2,
    “notification”: {
    “id”: “18049”,
    “type”: “normal”,
    “language”: “en”,
    “suffix”: null,
    “action”: “pushNotification”
    },
    “building”: {
    “id”: “10097”,
    “name”: “Buidling name”
    },
    “topic”: “com.intelligent.OpenAPIDemo”,
    “aps”: {
    “alert”: {
    “title”: “test8”,
    “body”: “Hola Veera. Esta es una alerta de prueba de la India. Espero que hayas recibido esto. Si usted puede leer esto. Puedes ir a Panamá.”
    },
    “badge”: 1,
    “mutable-content”: 1,
    “sound”: “default”
    }
    }

     Sample payload: VoIP Push

    {
    “payload_version”: 2,
    “notification”: {
    “id”: “2776123”,
    “type”: “critical”,
    “language”: “en”,
    “suffix”: “to refer back to this alert or to see more information, please open the App”,
    “action”: “pushNotification”
    },”building”: {
    “id”: “16012”,”name”: “Building name”
    },
    “topic”: “com.intelligent.OpenAPIDemo.voip”,
    “aps”: {
    “alert”: {
    “title”: “test”,
    “body”: “test”
    },
    “badge”: 1,
    “mutable-content”: 1
    }
    }

    Description of the above payload parameters:

    • id: Any string. Generally, a good practice is to use the bundle ID
    • title: Title of the notification / alert
    • body: Actual content / information of the notification.
    • badge: To update batch count on the app icon
    • type: alert (Requires as type: alert)
    • All below alert types have to be True / False flags. If one alert type is true, all remaining are to be false.
      1. life_safety
      2. personal_safety
      3. critical
      4. ping
      5. weather_alert
      6. lightning_alert
      7. pc_urgent_alert
      8. Normal
      9. pc_emergency
      10. suggested
    •  
    1. Install and open the sample application in android devices
    2. A list of communities (nearby) for which the device is subscribed will be shown. As this auto-subscription is based on the user’s geo location, it shows different results in different locations. If there are no communities near to the user, the device will not be subscribed to any communities. 
    3. To add new communities for testing purposes:
        1. Launch In-telligent web portal 
          1. Prod: https://app.in-telligent.com/
          2. Dev: https://app.dev.in-telligent.com/
        2. Login using valid credentials.
        3. Click on “Communities” tab from top navigation.
        4. Click on “Add New community” from top navigations.
        5. Fill required fields and click on Save button.
        6. After saving user will navigate to community summary page where user can edit any fields if required.
        7. Newly created community should be auto-subscribed and listed in device on location changed / on app launch / after a specific time period (Currently set to 6 hours).
      1. Install and open the sample application.
      2. A list of communities (nearby) for which the device is subscribed will be shown. As this auto-subscription is based on the user’s geo location, it shows different results in different locations. If there are no communities near to the user, the device will not be subscribed to any communities. 
      3. To add new communities for testing purposes:
        1. Launch In-telligent web portal 
          1. Prod: https://app.in-telligent.com/
          2. Dev: https://app.dev.in-telligent.com/
        2. Login using valid credentials.
        3. Click on “Communities” tab from top navigation.
        4. Click on “Add New community” from top navigations.
        5. Fill required fields and click on Save button.
        6. After saving user will navigate to community summary page where user can edit any fields if required.
        7. Newly created community should be auto-subscribed and listed in device on location changed / on app launch / after a specific time period (Currently set to 6 hours).

    Testing can be done using the sample application that was shared as part of the build files.

    Testing can be done using the sample application that was shared as part of the build files. In Web portal we can verify it under community details in – View Sent Out Alerts

    7. INTEGRATION WITH IN-TELLIGENT

    Any partner application is required to integrate with In-telligent systems to maintain user authentication and to send notifications from In-telligent portals. 

    In order to integrate, the following details have to be shared with the In-telligent development team. Once the In-telligent development team receives the information, it may take up to two days to integrate with In-telligent systems.

    To send push notifications from the In-telligent portal, your application’s firebase FCM server key has to be shared with the In-telligent development team. This key can be retrieved from the Firebase console app created in Section 5.1 point 3.

    1. Locate the firebase project server key from the project created in Firebase console. (Project settings  Cloud Messaging  Server Key). 
    2. Share the details with the In-telligent development team.
    To send Apple PushKit notifications from the In-telligent portal, your application’s certificates are required
    1. Generate a P12 file in KEYS section in the Apple developer portal.
    2. Download the generated file.
    3. Share the file with the In-telligent development team.

    Last updated November 24, 2020

    Open API framework for In-telligent integration.

    1. PURPOSE

    This document is to provide guidance on how to integrate In-telligent’s Open API Library (Framework) with yoru Android and iOS mobile applications.

    The open API library has 3 features:

    DND Override feature will override the DND on the targeted device (iOS and Android) and raises the alarms/alerts for the following scenarios:

    1 – Device is in DND Mode

    2 – Device is in Silent Mode

    3 – Device is in DND Mode and manually silenced

    4 – Device is in DND Mode and the App is in idle state

    5 – Device is in DND Mode and the App is in killed state

    6 –  Device is in DND Mode and the App is running in background

    7 – Device is in DND Mode and the App is running in foreground mode

    8 – Device is in DND Mode and Flight mode, and WIFI is enabled

    1. Device is in DND Mode
    2. Device is in Silent Mode
    3. Device is in DND Mode and manually silenced
    4. Device is in DND Mode and the App is in idle state
    5. Device is in DND Mode and the App is in killed state
    6. Device is in DND Mode and the App is running in background
    7. Device is in DND Mode and the App is running in foreground mode
    8. Device is in DND Mode and Flight mode, and WIFI is enabled

    Also known as Auto Grouping. This feature allows the device to automatically subscribe to all the nearest In-telligent communities. This service will run in the background and automatically subscribes to nearest communities in following scenarios:

    a. When the app is in background state

    b. When the app is in foreground state

    c. When the app is in killed state

    The alert notification can be translated into a different language for better reading in a comfortable language.

    2. REQUIREMENTS (DEVELOPMENT ENVIRONMENT)

    Android:

    • Android Studio
    • Android Mobile Version 7.0 and above
    • Open API library file *
    • Partner Token
    • Google account
    • Server-side implementation – (App Owner’s server)
      • Ensure the App Owner’s server API implementation is utilizing Google firebase as described in the following link:

    https://firebase.google.com/docs/cloud-messaging/server

    • The notification payload should be created as per sample listed in Section 6 Server-side implementation

    iOS

    • Xcode 11.6 below
    • iOS Mobile Version 11.0 and above
    • Open API library file *
    • Partner Token
    • Apple developer account
    • Server-side implementation – 
      • Ensure the App Owner’s server API implementation is ready to send notification payload as per the sample listed in section 6

    * Supplied by In-telligent

    3. ABOUT THE FRAMEWORK

    The In-telligent Open API framework supports the integration of In-telligent proprietary code into any mobile application. Features include customer authentication, sending push notifications to subscribed users, automatically grouping users into “communities” based on real-time location and translation of text into any supported language.

    This feature overrides a mobile device’s DND and silent mode features in order to force an audible alert to that device.

    This feature allows the device to automatically subscribe to all the nearest in-telligent communities. This application will run in the background and listen for the device location change events and auto-subscribe or un-subscribe to respective communities.

    The Auto-subscribe functionality triggers in two scenarios:

    1 – User moves away from Geo-fence range: Open API will un-subscribe the user from the community.

    2 – User comes into a Geo-fence range: Open API will subscribe the user to the community.

     

    This feature translates the alert message to any available language. 

    Note: List of languages will be coming from the In-telligent (Refer section 5.5).

    4. INTEGRATION STEPS

    The following describes the required Android and iOS integration dependencies for the OpenAPI library.

      1. Open the Android Studio project.
      2. File  New  New Module  Select “import *.JAR / *.AAR package” and navigate to the location of the Open API library and import as a Module.
      3. Make sure this framework is added in the application folder structure.
      4. Add the following dependency as library: (project: build.gradle file dependencies section)

         classpath “io.realm:realm-gradle-plugin:10.0.0

      1. Add the following dependencies as plugin: (app: build.gradle file):

          apply plugin: ‘realm-android’

      1. Add the following dependencies as libraries: (app: build.gradle file dependencies section):

        implementation fileTree(dir: ‘libs’, include: [‘*.jar’])

      implementation ‘com.google.firebase:firebase-messaging:21.0.0’

     

        // FCM push messaging
        implementation ‘com.google.code.gson:gson:2.8.5’ // Gson parsing
        implementation ‘com.android.support.constraint:constraint-layout:2.0.4’

        //reactive
        implementation ‘io.reactivex.rxjava2:rxandroid:2.1.1’
        implementation ‘androidx.appcompat:appcompat:1.2.0’


        implementation ‘com.google.android.material:material:1.2.1’
        implementation ‘com.github.mrmike:ok2curl:0.4.5’
        //reactive

        implementation ‘io.reactivex.rxjava2:rxjava:2.2.12’
        implementation ‘io.reactivex.rxjava2:rxandroid:2.1.1’
        implementation ‘com.squareup.retrofit2:adapter-rxjava2:2.9.0’
        implementation ‘com.squareup.retrofit2:converter-gson:2.9.0’
        implementation ‘com.google.code.gson:gson:2.8.5’

        //BLE Scanning
        api ‘org.altbeacon:android-beacon-library:2.16.1’
        implementation ‘com.google.android.gms:play-services-maps:17.0.0’
        implementation ‘com.google.android.gms:play-services-location:17.1.0’
        implementation ‘androidx.localbroadcastmanager:localbroadcastmanager:1.0.0’
        implementation ‘com.google.firebase:firebase-messaging:21.0.0’
        implementation project(path: ‘:openapi-release-v4.0’)

    1. Open the XCode project in which you would like to integrate this framework.
    2. Drag and drop “OpenAPI.framework” into the bundle folder.
    3. Make sure this framework is added in both “Embedded Binaries” and “Linked Framework and libraries”
    4. Import the following third-party dependency libraries: 
      • Alamofire (~> 4.0)
      • SwiftyJSON
      • RealmSwift
      • DeviceGuru
    1. Install the above dependency frameworks by using cocoa pods.

    Ref: https://guides.cocoapods.org/using/getting-started.html

    1.      To generate the build please follow below steps
      1. Select Project Target > Edit Scheme > Archive > Pre-Actions
      2. Add Script
      3. Provide build settings from – Select the App Target
      4. Add the below Script

    FRAMEWORK=“OpenAPI”

    FRAMEWORK_EXECUTABLE_PATH=${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS

    do

    lipo -extract $ARCH $FRAMEWORK_EXECUTABLE_PATH -o $FRAMEWORK_EXECUTABLE_PATH$ARCH

    EXTRACTED_ARCHS+=($FRAMEWORK_EXECUTABLE_PATH$ARCH)

    done

    lipo -o $FRAMEWORK_EXECUTABLE_PATH-merged” -create ${EXTRACTED_ARCHS[@]}

    rm ${EXTRACTED_ARCHS[@]}

    rm $FRAMEWORK_EXECUTABLE_PATH

    mv $FRAMEWORK_EXECUTABLE_PATH-merged” $FRAMEWORK_EXECUTABLE_PATH

    5. FEATURE SPECIFIC INSTRUCTIONS

    1. Add the Google Services plugin as the last entry in your app level build.gradle file:

    apply plugin: ‘com.google.gms.google-services’  // Google Play services Gradle plugin // Step

    1. Add google services plugin to root level build.gradle file as below

    dependencies {
        classpath ‘com.google.gms:google-services:4.3.4’
        // …
    }

    1. Add Firebase to your project as described in the following link:

    https://firebase.google.com/docs/cloud-messaging/android/client

    1. Download google-services.json file (from firebase) and place in the app folder of the project structure.
    2. Note down the firebase project server key from the project created in Firebase console. (Project settings 🡪 Cloud Messaging 🡪 Server Key). 

    Note: This server key is used in later steps to send notification from Server / rest client

    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-Telligent.

    There are 2 methods in helping the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the 

     

    application cache. (This will be by default false in the first run).

    1. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);
            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);
            }
        }
    });

     

    1. The following steps need to be added to the Application class and performed one time on 

    initial launch of the mobile application:

     

    1. Initialize Open API 

    Make a call to OpenAPI.init() method from Open API as described below

    1. Setup configuration

    OpenAPI.Configuration configuration = new OpenAPI.Configuration.Builder()
            .setAppVersion(BuildConfig.VERSION_CODE).setDebug(true). .setEnvironment(Environment.RELEASE).build();
    OpenAPI.init(getApplicationContext(), configuration);

     

    1. By default, OpenAPI library would be connecting to Production servers. Environment.RELEASE is the default configuration. You can change to Environment.DEV, to switch between Prod and Dev servers.

    OpenAPI.Configuration configuration = new OpenAPI.Configuration.Builder()
            .setAppVersion(BuildConfig.VERSION_CODE).setDebug(true). .setEnvironment(Environment. DEV).build();

     

    1. Generate Device Token as described in the Firebase SDK link provided above
    2. This token is required to pass on to in-telligent servers to send push notifications to the device. Below code snippet shows how to send the FCM device token to Server.

    public static void main(String[] args) {
        OpenAPI.getInstance().registerPushToken((token,new Consumer<Boolean>() {
            @Override
            public void accept(Boolean status) {
                if (status)
                    Log.v(TAG, “Device Token Sent to server”);
                else
                    Log.v(TAG, “Failed to send. Please try again later.”);
            }
        });

     

    1. Enable additional DND permission –

    Some devices have additional DND settings to prevent the alert sounds. To handle the alerts in such devices, we need to request DND additional permission from user. If we enable the permission, the OpenAPI library will turn off the device DND for 60seconds to play sound and then turns off the DND again (automatic).

     

    Make a call to the below method in the home activity to request this special permission. Without this permission also the app will work (make audible sound) in all the devices where 

    DND additional settings are not manually enabled.

     

    OpenAPI.checkDNDPermission(this);

     

    1. Add the following permissions to the Manifest file (AndroidManifest.xml)

    <uses-permission android:name=“android.permission.FLASHLIGHT” />
    <uses-permission android:name=“android.permission.VIBRATE” />

    <uses-permission android:name=“android.permission.INTERNET” />

    <uses-permission android:name=“android.permission.MODIFY_AUDIO_SETTINGS” />

     

    1. Add the following service to the Manifest file within <application> tag

    <service android:name=“.FCMService”>
        <intent-filter>
            <action android:name=“com.google.firebase.MESSAGING_EVENT” />
        </intent-filter>
    </service>

     

    1. Setup the required Firebase methods as detailed in the following link:  

    https://firebase.google.com/docs/cloud-messaging/android/receive

     

      1. Override the onReceiveMessage method to receive the message payload and call below “relayPushNotification” method with message payload in the onReceiveMessage of FirebaseService. 

    OpenAPI.getInstance().relayPushNotification(pushNotification, this,new  CallReceiver());

     

    Note: The notification will have three button option – 

        1. Mark As Read
        2. Delete
        3. Open

                          The variations are – 

    1. In some devices these buttons will be visible by default.
    2. In some devices we need to expand notification to see the buttons.

                           The notification is in expandable form with following variations –

    1. In some devices notification is expanded by default.
    2. In some devices there will be arrow to expand.
    3. In some devices on dragging down notification will expand.

    Below is the callback receiver and call actions in the application receiver from the library.

    public class CallReceiver extends HeadsUpNotificationActionReceiver {
        @Override

        public void onReceive(Context context, Intent intent) {
            super.onReceive(context, intent);

            if (intent != null && intent.getExtras() != null) {
                String action =  intent.getAction();
                PushNotification data = (PushNotification) intent.getSerializableExtra(Actions.CALL_NOTIFICATION);
                NotificationManager notificationManager = (NotificationManager)context.
                        getSystemService(Context.NOTIFICATION_SERVICE);
                notificationManager.cancel(Integer.parseInt(data.getNotificationId()));
                OpenAPI.getInstance().getAudioHelper().stopRingtone();
                if (action != null) {

                    if (action.equals(Actions.ACTION_MARK_AS_READ) && data != null) {
                        Log.i(“CallReceiver”, “Mark as Read action”);

                    } else if (action.equals(Actions.ACTION_DELETE)) {
                        Log.i(“CallReceiver”, “Delete action”);

                    } else if (action.equals(Actions.ACTION_OPEN)) {
                        Log.i(“CallReceiver”, “Open action”);

                    }
                }

    1. In the project target folder 🡪 Capabilities 🡪 background modes enable the following:
    • Audio, Airplay, and Picture in Picture
    • Location updates
    • Voice over IP
    • Background fetch
    • Remote notifications
    1. In Capabilities, enable Push notifications.
    2. Register the application with the bundle identifier in apple developer website (https://developer.apple.com/) and enable VOIP services on the apple developer portal with the app ID and then create:
      1. Certificates: (Refer to the attached document – iOS Certificates creation process)
      2. Profiles: (Refer to the attached document – iOS Certificates creation process)
      3. Integrate: Install certificates by double clicking on the certificates. This is to run the development application in iPhone physical device and to send push notification using Pusher client.

     

    Ref: (attached document – iOS Certificates creation process)

    1. For VOIP services, 
    • Generate a P8 file in KEYS section in developer portal (Ref: attached document – iOS Certificates creation process)
    • Download the generated file
    • Integrate the above certificates with backend web services, which will initiate the notification (app owner’s server)
    1. Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-Telligent.

    There are 2 methods in helping the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

     

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)

     

    1. For further use, need to capture device tokens from the following delegates methods

     

    1. In Order to receive PushKit notification / Regular notification from In-telligent server, need to register captured device tokens (Regular Push token and VoIP Push token) with In-telligent using OpenAPI method “registerPushKitToken” as below,
    1. When the Regular push notification payload is received on the delegate method, call the 

    Open API method relayPushKitNotification and pass the received payload. The Open API library will handle the notification with the appropriate sound.

     

    1. When the PushKit payload is received on the delegate method, call the Open API method relayPushKitNotification and pass the received payload.   The Open API library will handle the notification with the appropriate sound.

    The auto subscription feature will subscribe or un-subscribe a device based on device location change events.  Once this functionality has been invoked, every user / device will automatically update into or out of In-telligent communities when entering or leaving a Geo fence. 

    To implement this functionality, the following steps must be taken.

    • Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    • Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);
            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);
            }
        }
    });


    • Auto Subscription: After authentication, the following method is used to initiate the auto subscription process: 

     

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_communities);

        OpenAPI.currentSubscriberDidChange(CommunitiesListActivity.this, new Consumer<SubscriberResponse>() {
            @Override
            public void accept(SubscriberResponse subscriberResponse) {
                if (subscriberResponse != null) {
                    Log.v(TAG, “SubscriberCommunities  received success”);

                    // Adding communities to list adapter UI
                    mAdapter = new CommunitiesListAdapter(subscriberResponse.getSubscriber().getBuildings());
                    recyclerView.setAdapter(mAdapter);

                } else {
                    Log.v(TAG, “SubscriberCommunitiesreceived failure”);
                }
            }
        });

     

    This will handle the following functionality:

      1. Handling location change Events:
        1. Get the device location and listen for subsequent location change events.
        2. Retrieving the Geo fence from server and automatically will add / remove Geo fence boundaries to / from the device.
      2. Get communities and Subscribe to new communities list from server.
        1. Get list of communities from In-telligent server API.
        2. Auto subscribe to the received communities from API.

    The above method is to be called after authorization and whenever app needs to start Auto-Subscription.

    • Community lists for a subscriber: 

    After auto subscription has been invoked, handle callback method – currentSubscriberDidChange () – to get a list of all communities that a device has been auto subscribed.  The following is a code snippet for this method:  

    OpenAPI.currentSubscriberDidChange(CommunitiesListActivity.this,new Consumer<SubscriberResponse>() {
            @Override

            public void accept(SubscriberResponse subscriberResponse) {

                if (subscriberResponse != null) {
                    Log.v(TAG, “Subscriber Communities  received success”);
                    subscriberResponse.subscriber.buildings

                } else {
                    Log.v(TAG, “SubscriberCommunitiesreceived failure”);
                }
            }
        });
    } catch (Exception e) {
            e.printStackTrace();
    }


    • Permissions:

    Add the following Geo Fence services to the application manifest.xml file and then handle the permission request.

    <uses-permission android:name=“android.permission.FLASHLIGHT” />
    <uses-permission android:name=“android.permission.VIBRATE” />
    <uses-permission android:name=“android.permission.INTERNET”/>
    <uses-permission android:name=“android.permission.MODIFY_AUDIO_SETTINGS” />

    The auto subscription feature will subscribe or un-subscribe a device based on device location change events.  Once this functionality has been invoked, every user / device will automatically update into or out of In-telligent communities when entering or leaving a Geo fence. 

    To implement this functionality, the following steps must be taken.

    • Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    • Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);
            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);
            }
        }
    });


    • Auto Subscription: After authentication, the following method is used to initiate the auto subscription process: 

     

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_communities);

        OpenAPI.currentSubscriberDidChange(CommunitiesListActivity.this, new Consumer<SubscriberResponse>() {
            @Override
            public void accept(SubscriberResponse subscriberResponse) {
                if (subscriberResponse != null) {
                    Log.v(TAG, “SubscriberCommunities  received success”);

                    // Adding communities to list adapter UI
                    mAdapter = new CommunitiesListAdapter(subscriberResponse.getSubscriber().getBuildings());
                    recyclerView.setAdapter(mAdapter);

                } else {
                    Log.v(TAG, “SubscriberCommunitiesreceived failure”);
                }
            }
        });

     

    This will handle the following functionality:

      1. Handling location change Events:
        1. Get the device location and listen for subsequent location change events.
        2. Retrieving the Geo fence from server and automatically will add / remove Geo fence boundaries to / from the device.
      2. Get communities and Subscribe to new communities list from server.
        1. Get list of communities from In-telligent server API.
        2. Auto subscribe to the received communities from API.

    The above method is to be called after authorization and whenever app needs to start Auto-Subscription.

    • Community lists for a subscriber: 

    After auto subscription has been invoked, handle callback method – currentSubscriberDidChange () – to get a list of all communities that a device has been auto subscribed.  The following is a code snippet for this method:  

    OpenAPI.currentSubscriberDidChange(CommunitiesListActivity.this,new Consumer<SubscriberResponse>() {
            @Override

            public void accept(SubscriberResponse subscriberResponse) {

                if (subscriberResponse != null) {
                    Log.v(TAG, “Subscriber Communities  received success”);
                    subscriberResponse.subscriber.buildings

                } else {
                    Log.v(TAG, “SubscriberCommunitiesreceived failure”);
                }
            }
        });
    } catch (Exception e) {
            e.printStackTrace();
    }


    • Permissions:

    Add the following Geo Fence services to the application manifest.xml file and then handle the permission request.

    <uses-permission android:name=“android.permission.FLASHLIGHT” />
    <uses-permission android:name=“android.permission.VIBRATE” />
    <uses-permission android:name=“android.permission.INTERNET”/>
    <uses-permission android:name=“android.permission.MODIFY_AUDIO_SETTINGS” />

    The language translation feature will translate community notifications from the original language to any other supported language. 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

     

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the 

    Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

     

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);
            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {

     

                Log.v(TAG, “Sign in received failure”);
            }
        }
    });

     

    1.   Building Notifications: After authentication and getting buildings (refer to section 5.3 point 3) the following method is used to get notifications for buildings using building ID.

    OpenAPI.getBuildingNotifications(this, new Consumer<HashMap<String, ArrayList<Notification>>>() {

            @Override
            public void accept(HashMap<String, ArrayList<Notification>> notificationsByBuilding) throws Exception {

    //Printing the Notifications with building ID
                notificationsByBuildings.entrySet().forEach(entry->{
                    System.out.println(entry.getKey() + ” ” + entry.getValue());
                });
                s
            }
        });

     

    1.   List of Languages: After getting building notifications, the following method is used to get a list of languages supported for Notification translation. 

    OpenAPI.getLanguages()

    OpenAPI.getLanguages(new Consumer<NotificationLanguageResponse>() {
            @Override
            public void accept(NotificationLanguageResponse languageResponse) throws Exception {
                System.out.println(languageResponse.getLanguages());
            }
        });

     

    1. Notification Translation: The method INLanguageManager.getTranslation() is used to retrieve the translated message and the title of the message. 

    Parameters: notification ID and target language.

    OpenAPI.getTranslation(id,languageValue,new Consumer<TranslationResponse>() {

            @Override
            public void accept(TranslationResponse translationResponse) throws Exception {

                System.out.println(translationResponse.getBody()),             System.out.println(translationResponse.getTitle());
            }
        });

    The language translation feature will translate community notifications from the original language to any other supported language. 

     

    To implement this functionality, the following steps must be taken.

    • Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

     

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)



    • Building Notifications: After authentication and getting buildings (refer to section 5.4 point 2) the following method is used to get notifications for buildings using “building id”.

     

    INSubscriberManager.shared.getBuildingNotifications ()


    • List of Languages: After getting building notifications, the following method is used to get a list of languages supported for Notification translation. 

    INLanguageManager.getLanguages() 


    • Notification Translation: The method INLanguageManager.getTranslation() is used to retrieve the translated message and the title of the message. 

    Parameters: notification ID and target language.



    INLanguageManager.getTranslation()

    A Community manager can initiate this API to send community alert to subscribers of his community. This will allow us to send different types of alerts (Regular, Personal, Ping, Critical, LSA) with or without attachments from the mobile app.

     

    To implement this functionality, the following steps must be taken.

    Note: (To become a community manager for any given community, you need to contact admin)

    Admin can add a Community Manager in In-telligent Web Portal. To register as a Manager, a valid email id / mobile number required. Once Admin adds a Community Manager for any given community, he will receive a link to set password. After setting the password, with that credentials Community Manager can login to the Mobile app.


    • Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

     

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)



    • Send Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.sendAlert(title: alertTitle, message: alertMessage, building: buildingInformation, attachments: attachmentsInformation, notificationType: NotificationType)

    Parameters

    title – 

    Required – Yes

    Type – String

     

    message – 

    Required – Yes

    Type – String

    building – 

    Required – Yes

    Type – INBuilding (OpenAPI library class)

    attachments – 

    Required – Yes

    Type – Array of CustomImage (OpenAPI library class)

    notificationType – 

    Required – Yes

    Type – NotificationType (OpenAPI library class)

    OpenAPI.sendAlert(title: title_value, message: message_value, building: building, attachments: attachments, notificationType: notification_type, success: {
            // Handle success response
        }) { (error) in
            // Handle error response
        }

    A Community manager can initiate this API to send community alert to subscribers of his community. This will allow us to send different types of alerts (Regular, Personal, Ping, Critical, LSA) with or without attachments from the mobile app.

    Note: (To become a community manager for any given community, you need to contact admin)

    Admin can add a Community Manager in In-telligent Web Portal. To register as a Manager, a valid email id / mobile number required. Once Admin adds a Community Manager for any given community, he will receive a link to set password. After setting the password, with that credentials Community Manager can login to the Mobile app.

    To implement this functionality, the following steps must be taken.

     

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on 

     

    initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);

            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);

            }
        }
    });


    • Send Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    OpenAPI.sendAlert(buildingId, title, message, notificationType, attachmentPaths, new Consumer<SuccessResponse>() {

            @Override
            public void accept(SuccessResponse successResponse) throws Exception{
                if (successResponse != null && successResponse.isSuccess()) {
                    Log.i(TAG, “Success”);

                }else{
                    Log.i(TAG, “Error”);

                }

            }
        });

     

    Parameters

    title – 

    Required – Yes

    Type – String

    message – 

    Required – Yes

    Type – String

    buildingID – 

    Required – Yes

                                       Type – String(To get building Id -refer to section 5.3 point 4). 

    attachments – 

    Required – optional

    Type – Array of CustomImage Paths

    notificationType – 

    Required – Yes

    Type – AlertType (OpenAPI library class)

    The delivered alert status feature will inform the server about notification being delivered to the user. It will be done without developer’s action on receiving an alert.

    The opened alert status feature will inform the server about notification being read by the user. 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

     

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);
            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);
            }
        }
    });


    • Call opened alert: After authentication, the following method is used to update server about alert opened status using notification ID.

     Parameters

    notificationId – 

    Required – Yes

    Type – int

    OpenAPI.alertOpened(notificationId, new Consumer< SuccessResponse>() {

            @Override
            public void accept(SuccessResponse successResponse) throws Exception {

                if (successResponse != null && successResponse.isSuccess()) {
    // Opened status successfully sent to server
                } else if (successResponse != null) {
                    Log.v(TAG, “Opened alert  failure “+ successResponse.getError());                               } else {
                    Log.v(TAG, “Opened alert  failure “);
                }
            }
        });

    The delete alert feature will enable a user to delete an alert. 

    To implement this functionality, the following steps must be taken.

    1.   Initialize Open API 

    The following method call need to be added to the Application class and performed one time on initial launch of the mobile application

          Make a call to OpenAPI.init() method from Open API

    1.   Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

    1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
    2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    userName – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – Gender (OpenAPI library class)

     

    getInstance().authorization(email, mobileNumber, userName, password, partnerToken, Gender.FEMALE, new Consumer<Boolean>() {
        @Override
        public void accept(Boolean status) {
            CommonUtils.closeDialog(MainActivity.this);

            if (status) {
                Log.v(TAG, “Sign in received success”);
                registerPushNotification();

            } else {
                Log.v(TAG, “Sign in received failure”);
            }
        }
    });


    • Call delete alert: After authentication and receiving at least 1 alert, the following method is used to delete an alert using notification ID.

     Parameters

    notificationId – 

    Required – Yes

                            Type – int

    OpenAPI.deleteAlert ()

    OpenAPI.deleteAlert (notificationId, new Consumer< SuccessResponse>() {

            @Override
            public void accept(SuccessResponse successResponse) throws Exception {

                if (successResponse != null && successResponse.isSuccess()) {
    // Alert successfully deleted
                } else if (successResponse != null) {
                    Log.v(TAG, “Delete alert  failure “+ successResponse.getError());                               } else {
                    Log.v(TAG, “Delete alert  failure “);
                }
            }
        });

    The delivered alert status will inform the server about notification being delivered to the user. 

    It will be done without developer’s action on receiving an alert.

    The opened alert status feature will inform the server about notification being read by the user. 

    To implement this functionality, the following steps must be taken

    • Configure: 

    In AppDelegate.swift file within didFinishLaunchingWithOptions method add the below

     

    code to configure the API setup

    #if DEBUG

      OpenAPI.configure(mode: .debug)

    #else

      OpenAPI.configure(mode: .release)

    #endif


    • Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

     

    Type – OpenAPIUserGender (OpenAPI library class)


    • Opened Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.openedAlert(notificationId: notification_id)

    Parameters

    notificationId – 

    Required – Yes

    Type – Int

    OpenAPI.openedAlert(notificationId: aNotification.id, success: {

                    //Handle success response

                }) { (error) in

                    //Handle failure response

                }

     

    The delete alert feature will enable a user to delete an alert. 

    To implement this functionality, the following steps must be taken.


    • Configure: 

    In AppDelegate.swift file within didFinishLaunchingWithOptions method add the below code to configure the setup for the API

    #if DEBUG

      OpenAPI.configure(mode: .debug)

    #else

      OpenAPI.configure(mode: .release)

    #endif


    • Authentication: Before we call any service from OpenAPI, we need to authenticate the Partner token which was received from In-telligent.

    There are 2 methods for the authentication process:

      1. CheckToken: – This is a method which looks for the authentication token in the application cache. (This will be by default false in the first run).
      2. authorization: – If the authentication token is not available, checkToken method returns false. Then a call to “authorization” method is required to get the authentication token and store it in cache. 

    Parameters

    partnerToken – 

    Required – Yes

    Type – String

    email/mobileNumber – 

    Required – Yes

    Type – String

    password – 

    Required – Yes

    Type – String

    name – 

    Required – Yes (Name or empty string)

    Type – String

    Default – If empty, default is email/mobilenumber

    gender – 

    Required – Yes

    Type – OpenAPIUserGender (OpenAPI library class)


    • Delete Alert: After authentication with community manager credentials, you will be able to access the below API call with the necessary information. 

    To get buildings list (refer to section 5.4 point 2). 

    OpenAPI.deleteAlert(notificationId: notification_id)

    Parameters

    notificationId – 

    Required – Yes

    Type – Int

    OpenAPI.deleteAlert(notificationId: notification.id, success: {

                //Handle success response

            }) { (error) in

                //Handle failure response

            }

     

    6. HOW TO TEST

    Using In-telligent Portal: You can use the In-telligent portal to send notifications once section 7 (below) has been fully integrated on the In-telligent servers.

    1. Launch In-telligent web portal

     

     

      1. Prod: https://app.in-telligent.com/
      2. Dev: https://app.dev.in-telligent.com/
    1. Login using valid credentials.
    2. Click on “Communities” tab from top navigation.
    3. Select community from list to send alert notification.
    4. Once community page is opened, click on “send a community alert” from left sidebar navigation.
    5. Enter required fields, select type of alert and click on send button to send to subscribed users for selected community.
    6. Alert should send to the selected/all users in community.

    Using REST client

    The following approach can be used to test third-party application functionality without interaction with the In-telligent messaging service.

     

    NOTE: The In-telligent messaging service can also be used for testing purposes once the third-party application has been fully integrated with the In-telligent backend services.  See section 7 below for more information.

     

    1. Use REST client to send notification to the device
    • Replace the value for the “to” field with the generated device token (step 5.1), replace the value for the “key” field with the server key (noted in step 5.1) and send notification.

    Note: For actual implementation on the server (app owner server), please go through the below documentation.

    https://firebase.google.com/docs/cloud-messaging/server

    1. Print and capture the device token from Log as soon as you run the application on the device.
    2. Use this device token, the server key (noted in section 5.1) and the following payload to send the notification.
    3. Device will receive the alert and the respective sound. If the app developer wants to show the alert within the application, please capture the details from the payload and display accordingly.

    A sample notification payload should be as follows:

    {

      “data”: {

       “life_safety”: false,

       “personal_safety”: false,

       “critical_safety”: true,

       “ping_alert”: false,

       “weather_alert”: false,

       “lightning_alert”: false,

       “pc_urgent_alert”: false,

       “pc_emergency_alert”: false,

       “notification_id”: “123456”,

       “title”: “Notification Title”,

    “body”: “Actual content of the message”,

    /// Any additional fields you may want

       },

    “to”: “fW40hcEO9PA:APA91bFJr2-nwkSuBfhL3_g2Q3iPZOZGcx-P6B_zVVR_7k1zMDC-qFIYcdzdNE_h2ecRO17Sw2tvcHp7xLkAArajyILRAgYolHJt8CuXo7t66TB48VoOeTdQPI-Mtq0HKjxKPXF4S_BM”

    }

    Description of the above payload parameters:

    • title: Title of the notification / alert

     

    • body: Actual content / information of the notification.
    • notification_id: Notification ID to differentiate from one notification to other. It is a 

    number format (Ex: 123456)

    • All below alert types have to be True / False flags. If one alert type is true, all remaining are to be false.
      1. life_safety
      2. personal_safety
      3. critical_safety
      4. ping_alert
      5. weather_alert
      6. lightning_alert
      7. pc_urgent_alert
    1. pc_emergency_alert

    To: This is the Device Token generated on the Android device as soon as you run the application. This will be unique to a device. If the same app runs on a different device, the generated device token will be different.

    Using In-telligent Portal: 

    You can use the In-telligent portal to send notifications once section 7 (below) has been fully integrated on the In-telligent servers.

     

    1. Launch In-telligent web portal 
      1. Prod: https://app.in-telligent.com/
      2. Dev: https://app.dev.in-telligent.com/
    2. Login using valid credentials.
    3. Click on “Communities” tab from top navigation.
    4. Select community from list to send alert notification.
    5. Once community page is opened, click on “send a community alert” from left sidebar navigation.
    6. Enter required fields, select type of alert and click on send button to send to subscribed users for selected community.
    7. Alert should send to the selected/all users in community.
    8. If it is critical alert(Ping, Critical, LSA,PC LSA, Weather, Lightning), it should come with 

     

    VOIP call otherwise it should come with regular push notification

     

    Using Pusher Client

    The following approach can be used to test third-party application functionality without interaction with the In-telligent messaging service.

    NOTE: The In-telligent messaging service can also be used for testing purposes once the third-party application has been fully integrated with the In-telligent backend services.  See section 7 below for more information.

    1. Use Pusher client to send a notification to the device

    Ref: https://github.com/noodlewerk/NWPusher

     

    1. Print and capture the device token from Log as soon as you run the application on the device.
    2. Use this device token, select certificate related to the bundle ID and the sample payload shown below to send the notification.
    3. The device will receive the alert and the respective sound. If the app developer wants to show the alert within the application, please capture the details from the payload and display accordingly.

     Sample payload: Regular Push

    {

    “_sid”: “com.intelligent.OpenAPIDemo”,

    “type”: “alert”,

    “alert_type”: “normal”,

    “notification_lang”: “en”,

    “id”: 2355456,

    “building_id”: 15574,

    “building_name”: “open api ios “,

    “notification_id”: 2355456,

    “notification_title”: “test regular”,

    “body”: “test regular”,

    “title”: “open api ios: test regular”,

    “message_suffix”: “to refer back to this alert or to see more information, please open the App”,

    “weather_alert”: 0,

    “life_safety”: 0,

    “personal_safety”: 0,

    “multi”: 0,

     

    “critical_safety”: 0,

    “ping_alert”: 0,

    “pc_urgent_alert”: 0,

    “lightning_alert”: 0,

    “pc_emergency_alert”: 0,

    “increment_badge”: 1,

    “targetApps”: [

    “open – api – demo”

    ],

    “aps”: {

    “alert”: {

    “body”: “test regular”,

    “title”: “open api ios: test regular”

    },

    “content-available”: 1,

    “sound”: “default”

    },

    “notificationId”: 2355456,

    “alertType”: “normal”,

    “buildingId”: 15574

    }



    Sample payload: VoIP Push

    {

    “_sid”: “com.intelligent.OpenAPIDemo”,

    “building_id”: 15574,

    “id”: 2355460,

    “title”: “open api ios: test VoIP”,

    “building_name”: “open api ios”,

    “notification_id”: 2355460,

    “notification_lang”: “bg”,

    “notification_title”: “test VoIP”,

    “body”: “test VoIP”,

    “alert_type”: “ping”,

    “message_suffix”: “да се върна към този сигнал или да видите повече информация, моля, отворете приложението”,

    “pc_urgent_alert”: 0,

    “lightning_alert”: 0,

    “weather_alert”: 0,

    “personal_safety”: 0,

    “pc_emergency_alert”: 0,

    “critical_safety”: 0,

    “multi”: 0,

     

    “life_safety”: 0,

    “ping_alert”: 1,

    “increment_badge”: 1,

    “type”: “alert”,

    “aps”: {

    “alert”: {

    “body”: “test VoIP”,

    “title”: “open api ios: test VoIP”

    },

    “content-available”: 1,

    “sound”: “default”

    },

    “targetApps”: [“open-api-demo”],

    “alertType”: “ping”,

    “buildingId”: 15574,

    “notificationId”: 2355460

    }

     

    Description of the above payload parameters:

    • _sid: Application bundle ID.
    • id: Any string. Generally, a good practice is to use the bundle ID
    • title: Title of the notification / alert
    • body: Actual content / information of the notification.
    • alertType: Type of alert that is being sent. Applicable values are (“normal”, “critical”, “ping”, “weather-alert”, “lightning-alert”, “personal-safety”, “life-safety”, “suggested”, “response”, “pc-emergency”, “pc-urgent”)
    • increment_badge: To update batch count on the app icon
    • type: alert (Requires as type: alert)
    • All below alert types have to be True / False flags. If one alert type is true, all remaining are to be false.
      • life_safety
      • personal_safety
      • critical_safety
      • ping_alert
      • weather_alert
      • lightning_alert
      • pc_urgent_alert

     

      • pc_emergency_alert
      1. Install and open the sample application in android devices
      2. A list of communities (nearby) for which the device is subscribed will be shown. As this auto-subscription is based on the user’s geo location, it shows different results in different locations. If there are no communities near to the user, the device will not be subscribed to any communities. 
      3. To add new communities for testing purposes:
        1. Launch In-telligent web portal 
          1. Prod: https://app.in-telligent.com/
          2. Dev: https://app.dev.in-telligent.com/
        2. Login using valid credentials.
        3. Click on “Communities” tab from top navigation.
        4. Click on “Add New community” from top navigations.
        5. Fill required fields and click on Save button.
        6. After saving user will navigate to community summary page where user can edit any fields if required.
        7. Newly created community should be auto-subscribed and listed in device on location changed.
      1. Install and open the sample application.
      2. A list of communities (nearby) for which the device is subscribed will be shown. As this auto-subscription is based on the user’s geo location, it shows different results in different locations. If there are no communities near to the user, the device will not be subscribed to any communities. 
      3. To add new communities for testing purposes:
        1. Launch In-telligent web portal 
        2. Login using valid credentials.
        3. Click on “Communities” tab from top navigation.
        4. Click on “Add New community” from top navigations.
        5. Fill required fields and click on Save button.
        6. After saving user will navigate to community summary page where user can edit any fields if required.
        7. Newly created community should be auto-subscribed and listed in device on location changed.

    Testing can be done using the sample application that was shared as part of the build files.

    Testing can be done using the sample application that was shared as part of the build files. In Web portal we can verify it under community details in – View Sent Out Alerts

    7. INTEGRATION WITH IN-TELLIGENT

    Any partner application is required to integrate with In-telligent systems to maintain user authentication and to send notifications from In-telligent portals. 

    In order to integrate, the following details have to be shared with the In-telligent development team. Once the In-telligent development team receives the information, it may take up to two days to integrate with In-telligent systems.

    To send push notifications from the In-telligent portal, your application’s firebase FCM server key has to be shared with the In-telligent development team. This key can be retrieved from the Firebase console app created in Section 5.1 point 3.

    1. Locate the firebase project server key from the project created in Firebase console. (Project settings  Cloud Messaging  Server Key). 
    2. Share the details with the In-telligent development team.

    To send Apple PushKit notifications from the In-telligent portal, your application’s certificates are required.

    1. Generate a P8 file in KEYS section in the Apple developer portal.
    2. Download the generated file.
    3. Share the file with the In-telligent development team.
    7062bab2 8b856cab 8b856cab In Telligent App Branding Logo.png

    This website uses cookies to ensure you get the best experience on our website.