GuidesDiscussions
Log In
Guides

Advanced Settings

Information about the feature advanced optionals

1. Sensitive Data

Add Gradle aditional dependencies :

If you want the SDK to collect sensitive data, add the following modules as needed:

ModuleSensitive DataDependency
AppServicesInstalled Apps - Running Appsimplementation 'com.digitalreef.phoenix:app-services:<version>'
PhoneServicesIMEI1 - IMEI2 - Serial Numberimplementation 'com.digitalreef.phoenix:phone-services:<version>'
TelephonyServicesPhone Number - IMSI - ICCID - Sim Data Slotimplementation 'com.digitalreef.phoenix:telephony-services:<version>'

Note: When including any of the modules, all sensitive data corresponding to that module will be captured.

implementation platform("com.digitalreef.phoenix:bom:<version>")
implementation "com.digitalreef.phoenix:<variant>"
implementation "com.digitalreef.phoenix:app-services"
implementation "com.digitalreef.phoenix:phone-services"
implementation "com.digitalreef.phoenix:telephony-services"
implementation(platform("com.digitalreef.phoenix:bom:<version>"))
implementation("com.digitalreef.phoenix:<variant>")
implementation("com.digitalreef.phoenix:app-services")
implementation("com.digitalreef.phoenix:phone-services")
implementation("com.digitalreef.phoenix:telephony-services")

Add Permissions for Sensitive Data :

The data sensible requires permissions depending on the data that is collected, please add to the manifest as appropriate:

AppServices

You can use the following code in your manifest, inside <application> tag:

<manifest>
<!--your code -->

    <queries>
        <intent>
            <action android:name="*" />
        </intent>
    </queries>

</manifest>

PhoneServices

Your can use for Android 9 and below:

<uses-permission  android:name="android.permission.READ_PHONE_STATE" />

For Android 10+ only is captured if the app in preloaded:

<uses-permission  android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />

Note: This permission is only for preloaded variant

TelephonyServices

Your can use for Android 9 and below:

<uses-permission  android:name="android.permission.READ_PHONE_STATE" />

For Android 10+:

<uses-permission  android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission  android:name="android.permission.READ_PHONE_STATE" />

For Preloaded App (Android 10+):

<uses-permission  android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />

Note: This permission is only for preloaded variant

Enable/Disable capture of Sensitive Data:

Capturing sensitive data requires a prominent disclosure, and the user must consent to the app's data capture and usage. If the user consents, the app should send a boolean flag using the following method:

Keep in mind that capturing data deemed sensitive depends on the user’s acceptance of the prominent popup, which must be created and managed by the host application.

SiprocalSDK.setSensitiveData(value);
SiprocalSDK.setSensitiveData(value)

2. Custom Organization Selection

If the client wishes to have the same app available for different organizations, use the following
API from the Siprocal SDK:

SiprocalSDK.setCountryCodeSelected(context, countryCode);
SiprocalSDK.setCountryCodeSelected(context, countryCode)

Ensure that the country code mappings are created in the Siprocal servers before going live.

3. Turn ON/OFF the SDK:

If you want to handle the turning on and off of the SDK, add the method activeSDKManually() to the SiprocalSDKSettings:

public class App extends Application { 
  @Override
  public void onCreate(){
      super.onCreate();
      SiprocalSDKSettings siprocalSDKSettings = new SiprocalSDKSettings.Builder()
        .activeSDKManually()
        .build();
      SiprocalSDK.init(this, siprocalSDKSettings);
  }
}
class App: Application() {
  override fun onCreate() {
      super.onCreate()
      val siprocalSDKSettings = SiprocalSDKSettings.Builder()
          .activeSDKManually()
          .build()
      SiprocalSDK.init(this, siprocalSDKSettings)
  }
}

⚠️ The SDK by default is OFF, you need use setSDKStatus for Turn On the SDK.

That way you can then use the following method to turn it on/off:

Turn ON:

SiprocalSDK.setSDKStatus(true);
SiprocalSDK.setSDKStatus(true)

Turn OFF:

SiprocalSDK.setSDKStatus(false);
SiprocalSDK.setSDKStatus(false)

4. Passing Client Attributes to the Siprocal SDK

In some cases, the host application may need to pass attributes to the Siprocal SDK. This is
supported with the ClientAttributes class provided as part of the SDK.

To set client attributes and pass them to the Siprocal SDK, follow this code snippet:

JSONObject jsonObject = new JSONObject();
jsonObject.put("Param1", "Value1");
jsonObject.put("Param2", "Value2");
SiprocalSDK.setClientAttributes(jsonObject);
val jsonObject = JSONObject()
jsonObject.put("Param1", "Value1")
jsonObject.put("Param2", "Value2")
SiprocalSDK.setClientAttributes(jsonObject)

5. Opt-In / Opt-Out settings

The host application can provide an option to the users to Opt-In and Opt-Out of the Ads services. The same can be accomplished via the following methods to access or update the Status.

Update Opt-In status

SiprocalSDK.updateOptInStatus(applicationContext, value);
SiprocalSDK.updateOptInStatus(applicationContext, value)

Get Opt-In status

Boolean status = SiprocalSDK.getOptInStatus();
val status = SiprocalSDK.getOptInStatus()

6. Notification Channel

If you need to know information about the SDK notification channel you can use the following methods.

String channelId = SiprocalSDK.getNotificationChannelId();
String channelName = SiprocalSDK.getNotificationChannelName();
val channelId = SiprocalSDK.getNotificationChannelId()
val channelName = SiprocalSDK.getNotificationChannelName()

7. Enable logs

For debug purpose you can use the method .enableLogInfoSdk() to see the logs of SDK. In Android Studio Logcat search the word SiprocalSdk


public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        SiprocalSDKSettings siprocalSDKSettings = new SiprocalSDKSettings.Builder()
                .enableLogInfoSdk()
                .build();
        SiprocalSDK.init(this, siprocalSDKSettings);
    }
}
class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        val siprocalSDKSettings: SiprocalSDKSettings = SiprocalSDKSettings.Builder()
            .enableLogInfoSdk()
            .build()
        SipocalSDK.init(this, siprocalSDKSettings)
    }
}

8. Tracking In-App Events

Siprocal SDK has potential to accept and track In-App Events from the host application, which can be used for tracking the User Journey and make many suggestive In-App message that can be configured and displayed to the user.

The SDK is preconfigured to track the following events by automatically:

  • 1st Open of the Application
  • Application coming to foreground
  • Application going to background

Sending events from Host application to SDK

Host Application can add any number of events to be tracked by the SDK.

Example for sending events :

String eventName = "EVENT_NAME";// Event name
SiprocalSDK.trackInAppEvents(context, eventName);
val eventName = "EVENT_NAME" // Event name
SiprocalSDK.trackInAppEvents(context, eventName)

9. Support to handle notification in LockScreen

If your app shows notifications on the lock screen. It is required to add the following methods so that the SDK correctly handles the behavior of the pendingIntent of the notification

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        SiprocalSDKSettings siprocalSDKSettings = new SiprocalSDKSettings.Builder()
                .setLockScreenActivityName(LockScreenActivity.class.getSimpleName())
                .build();
        SiprocalSDK.init(this, siprocalSDKSettings);
    }
}
class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        val siprocalSDKSettings: SiprocalSDKSettings = SiprocalSDKSettings.Builder()
            .setLockScreenActivityName(LockScreenActivity::class.simpleName ?: "LockScreenActivity")
            .build()
        SipocalSDK.init(this, siprocalSDKSettings)
    }
}

In the place where you invoke the pendingIntent of the notification clicked added the method clickNotificationFromLockScreen() before to invoke the pending Intent

public class MainActivity extends AppCompatActivity {
    @Override
    public void onCreate() {
        super.onCreate();
        SiprocalSDK.clickNotificationFromLockScreen()

        /**
         * sample code host app LockScreen
         * pendingIntent.send();
         */

    }
}
class MainActivity : AppCompatActivity() {
    override fun onCreate() {
        super.onCreate()
        SiprocalSDK.clickNotificationFromLockScreen()

        /**
         * sample code host app LockScreen
         * pendingIntent?.send()
         */
    }
}

10. Customize Notification Sound

The SDK allow to customize the notifications sound, taking account the next recommendations:

  • Sound formats:
    • OGG (.ogg): Lightweight and plays smoothly on Android.
    • MP3 (.mp3): Wide support and widely used
  • File size: As a general recommendation, keep a weight of less than 300 KB per sound file for notifications. As they are notification sounds, they usually play quickly; Very large files can delay playback or increase the weight of the application unnecessarily.
  • Duration: 1 to 3 seconds: Because on Android, notification sounds play in a short loop or just once. A longer sound can be annoying or interrupt the user.
  • Location: SiprocalSDK will always search for files in the res/raw path of the host app.
  • Number of files: SiprocalSDK supports maximum 5 custom notification sounds.
  • File Names: File names must be without spaces or special characters; They must always respect the following standard names:
    • sip_notif_sound_1.ogg (format can be OGG or MP3)
    • sip_notif_sound_2.ogg
    • sip_notif_sound_3.ogg
    • sip_notif_sound_4.ogg
    • sip_notif_sound_5.ogg
  • 5 is the maximum number of custom sounds in addition to the device's default sound; The customer can use only the desired amount as long as it does not exceed the maximum amount.

You must define a channel name for each sound file you add, up to a maximum of 5. The name of each channel must correspond to the order in which they were added. Example:

public class MainActivity extends AppCompatActivity {
    @Override
    public void onCreate() {
        super.onCreate();
        SiprocalSDKSettings siprocalSDKSettings = new SiprocalSDKSettings.Builder()
                .setNotificationChannelNames(Arrays.asList("Alerts", "Promos", "Top-ups", "Services", "TV"))
                .build();

        SiprocalSDK.init(this, siprocalSDKSettings);
    }
}
class MainActivity : AppCompatActivity() {
  override fun onCreate() {
        super.onCreate()
        val siprocalSDKSettings = SiprocalSDKSettings.Builder()
            .setNotificationChannelNames(listOf("Alerts", "Promos", "Top-ups", "Services", "TV"))
            .build()

        SiprocalSDK.init(this, siprocalSDKSettings)
    }
}

11. Support for Apps Without a Launcher Activity

If your app has no Activity with the android.intent.category.LAUNCHER category, register a host Activity with enableActivityHandling(...). When a user taps a notification that opens in-app campaign content and the host app is in the background, the SDK can launch the registered Activity and then open its own campaign screen.

How is the content rendered?

The SDK displays native in-app campaign content in its own Activity using Jetpack Compose.

What does the host Activity need?

Create a concrete Activity that extends android.app.Activity or a compatible subclass. Give it an opaque theme with a visible background while the SDK opens the campaign screen. This example uses AppCompatActivity and loads res/layout/activity_invisible.xml to display the host UI. Use an AppCompat-compatible theme and let the Activity reach onStart() so the SDK can open the campaign screen.

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

public class InvisibleActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_invisible);
    }
}
import android.app.Activity

class InvisibleActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_invisible)
    }
}

Declare the Activity under <application> in AndroidManifest.xml with android:exported="false". The SDK launches it explicitly within the same app, so no intent filters or launcher entry are required.

<activity
    android:name=".InvisibleActivity"
    android:exported="false"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"  />

You can replace the example theme with your app's own opaque theme with a visible background.

Optional overlay protection: On Android 12 (API 31) or later, the SDK hides non-system overlays on the Activity registered with enableActivityHandling(...) when overlay protection is enabled at Activity creation and the host app declares android.permission.HIDE_OVERLAY_WINDOWS. See Enable overlay protection.

Register the Activity

Register the same Activity when initializing the SDK in Application.onCreate().

import android.app.Application;
import com.siprocal.sdk.client.SiprocalSDK;
import com.siprocal.sdk.client.SiprocalSDKSettings;

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        SiprocalSDKSettings settings = new SiprocalSDKSettings.Builder()
                .enableActivityHandling(InvisibleActivity.class)
                .build();

        SiprocalSDK.init(this, settings);
    }
}
import android.app.Application
import com.siprocal.sdk.client.SiprocalSDK
import com.siprocal.sdk.client.SiprocalSDKSettings

class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        val settings = SiprocalSDKSettings.Builder()
            .enableActivityHandling(InvisibleActivity::class.java)
            .build()

        SiprocalSDK.init(this, settings)
    }
}

12. Optional Location Services Module

Starting with SDK 5.14.0, location collection and geofence campaigns require the Location Services module. Add it only if your app uses either feature.

Add the dependency

Use the same version as your Siprocal SDK. If your app already uses the Siprocal BOM, omit :<version> from the dependency.

Groovy

implementation "com.digitalreef.phoenix:location-services:<version>"

Kotlin DSL

implementation("com.digitalreef.phoenix:location-services:<version>")

Location permissions

Declare these permissions directly under <manifest> in the host app's AndroidManifest.xml and request location access at runtime.

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

Geofence campaigns require the user to grant precise location and the device to have Google Play services available.

Background location

On Android 10 (API 29) or later, background location collection and geofence registration also require background location access. Declare the permission and follow the background location permission flow for the device's Android version.

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

Restore geofences after a reboot

To let the SDK re-register saved geofences after the device restarts, declare this permission directly under <manifest>.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Foreground service for location collection on Android 10

If the SDK collects location in the background on Android 10 (API 29) using its foreground worker, declare FOREGROUND_SERVICE and add the location type to WorkManager's foreground service.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    <application>
        <service
            android:name="androidx.work.impl.foreground.SystemForegroundService"
            android:foregroundServiceType="location"
            tools:node="merge" />
    </application>
</manifest>

If your app or another SDK already uses this WorkManager service, keep all required types in a single declaration, separated by |. For example, use android:foregroundServiceType="dataSync|location" if another worker requires dataSync.

If manifest merging reports a conflict on this attribute, add tools:replace="android:foregroundServiceType" to the service declaration, keeping all required types. Check the final configuration in Android Studio's Merged Manifest.


Did this page help you?