Cobrowse.io Docs
  • Getting started
  • SDK Installation
    • Web
    • iOS
    • Android
    • React Native
    • Flutter
    • .NET Mobile
    • macOS
    • Windows
  • SDK Features
    • Account config
    • Identify your devices
    • Use 6-digit codes
    • Redact sensitive data
    • Viewing PDFs
    • Universal Cobrowse
    • Customize the interface
      • Active session controls
      • 6-digit code screen
      • User consent dialog
      • Remote control consent dialog
      • Full device consent dialog
      • Localization / translation
    • Initiate sessions with push
    • Listening for events
    • Full device capabilities
      • Full device screen sharing
      • Full device remote control
      • Managing full device mode
    • Advanced configuration
      • Starting and stopping the SDK
      • Declaring capabilities
      • Intercepting mobile SDK network requests
      • Web
        • IFrames support
        • IE 11 polyfills
        • Cross-domain session support
        • Ignore Views
      • iOS
        • Alternate render method
        • Custom touch handling
      • Android
        • Backporting TLS to older Android versions
  • Agent-side integrations
    • Agent-side overview
    • Platform integrations
      • Zendesk
      • Salesforce
        • Migrating from legacy to v2
        • Salesforce (Legacy)
      • Genesys
        • Genesys Cloud
        • Engage Workspace Web Edition (WWE)
        • Engage Workspace Desktop Edition (WDE)
      • Intercom
      • Freshworks
      • Talkdesk
      • NICE
    • Custom integrations
    • Agent SDK
      • API Reference
      • Sample code snippets
    • Authentication (JWTs)
      • JWT Policies
    • Authentication (SAML 2.0)
    • IFrame embeds
  • Enterprise self-hosting
    • Self-hosting overview
    • Docker Compose
    • Helm chart
      • Image Pull Secret
      • Environment Variables
      • Optional recording components
      • Pod Annotations
    • AWS terraform
      • AWS metrics configuration
    • Azure terraform
      • Azure metrics configuration
    • GCP terraform
      • GCP metrics configuration
    • Sizing guidelines
    • Running your instance
      • Adding a superuser
      • Limiting account creation
      • Limiting magic link recipients
      • Configuring SMTP
      • Managing your deployment
    • Monitoring your instance
      • Available metrics
      • Self-Hosted Prometheus
    • Advanced configuration
      • Air gap configuration
      • Pin web SDK version
      • L7 firewall configuration
      • Docker proxy configuration
    • Troubleshooting
Powered by GitBook
On this page

Was this helpful?

  1. SDK Features

Initiate sessions with push

For use with Android, iOS, React Native, Flutter, and .NET Mobile SDKs only.

PreviousLocalization / translationNextListening for events

Last updated 2 months ago

Was this helpful?

By default, Cobrowse Native SDKs for Android and iOS open a socket to handle incoming session requests.

You may optionally send new session requests over the native push channel. Cobrowse supports this configuration out of box using Firebase Cloud Messaging (FCM).

For sessions to start by push the user needs to have the client application open in the foreground. This method will not send a visible push notification to the user.

If you wish to use visible push, this is possible using your own existing push channel and can be fully customized.

Setup your Firebase account:

  1. Create an account for .

  2. Create a new project from your .

  3. In your Project settings, add entries for your Android and iOS apps.

  4. For iOS, you will need generate an APNs Authentication Key (recommended) or APNs Certificate from . You may then upload it under Project Settings -> Cloud Messaging.

  5. Please generate a Firebase Private Key file from Project Settings -> Service Accounts, download it and enter its contents into your .

A few changes to native code as described below.

You first need to registerForRemoteNotificataions()at a location that is right for your application.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    application.registerForRemoteNotifications()
}

Once requested the didRegisterForRemoteNotificationsWithDeviceTokendelegate method will be called. You must then pass this token to Cobrowse using the CobrowseIO.setDeviceToken method.

This device will now be associated associate with the push token winth the Cobrowse dashboard.

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    CobrowseIO.setDeviceToken(deviceToken)
}

You must first add Firebase Cloud Messaging (FCM) to your app. Please see FCM documentation at .

Next, whenever your device receives a registration token or push notification from FCM, pass that to the Cobrowse.io SDK, for example:

package com.example;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

import io.cobrowse.CobrowseIO;

public class FirebaseMessaging extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        CobrowseIO.instance().onPushNotification(remoteMessage.getData());
    }

    @Override
    public void onNewToken(String token) {
        CobrowseIO.instance().setDeviceToken(getApplication(), token);
    }

}

Next, whenever your device receives a registration token from FCM, pass that to the Cobrowse.io SDK, for example:

import CobrowseIO from 'cobrowse-sdk-react-native';

CobrowseIO.deviceToken = "<your FCM token>";

Next, whenever your device receives a registration token from FCM, pass that to the Cobrowse.io SDK, for example:

import 'package:cobrowse_sdk_flutter/cobrowseio.dart';

if (Platform.isAndroid) {
    // Only required on Android, iOS does this automatically
    CobrowseIO.instance.setDeviceToken('<your FCM token>');
}

.NET iOS implementation

If you are already using push notifications in your app, there is nothing further required on the native side.

If you are not already using push notifications in your app, please enable them under Capabilities in the iOS app project and request push permission from the user whenever is appropriate:

[Export("applicationDidBecomeActive:")]
public void OnActivated(UIApplication application)
{
    application.RegisterUserNotificationSettings(
        UIUserNotificationSettings.GetSettingsForTypes(
            UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert,
            categories: null));
    application.RegisterForRemoteNotifications();
}

.NET Android implementation

Next, whenever your device receives a registration token or push notification from FCM, pass that to the Cobrowse.io SDK, for example:

using System;
using Android.App;
using Android.Runtime;
using Firebase.Messaging;
using Cobrowse.IO.Android;

namespace YourAppNamespace
{
    [Service]
    [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
    public class FirebaseMessaging : FirebaseMessagingService
    {
        public FirebaseMessaging()
        {
        }

        protected FirebaseMessaging(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
        {
        }

        public override void OnMessageReceived(RemoteMessage remoteMessage)
        {
            CobrowseIO.Instance.OnPushNotification(remoteMessage.Data);
        }

        public override void OnNewToken(string token)
        {
            CobrowseIO.Instance.SetDeviceToken(Application, token);
        }
    }
}

You must first add Firebase Cloud Messaging (FCM) to your app. Please see FCM documentation at .

You must first add Firebase Cloud Messaging (FCM) to your app. Please see FCM documentation at .

You must first add Firebase Cloud Messaging (FCM) to your app. Please see FCM documentation at .

Firebase
Firebase console
https://developer.apple.com
Firebase settings
https://firebase.google.com/docs/cloud-messaging/android/client
https://firebase.google.com/docs/cloud-messaging/android/client
https://firebase.google.com/docs/cloud-messaging/android/client
https://docs.microsoft.com/en-us/xamarin/android/data-cloud/google-messaging/firebase-cloud-messaging