Skip to content

Privacy settings

Olga Koroleva edited this page Jul 25, 2023 · 7 revisions

MobileMessaging SDK has several options to provide different levels of users' privacy for your application. The settings, enabled by default, are available through MobileMessaging.Builder class and may be modified as follows:

MobileMessaging.Builder(application)
                .withoutCarrierInfo()
                .withoutSystemInfo()
                .withoutStoringUserData()
                .withoutStoringApplicationCode(MyApplicationCodeProvider())
                .withDisplayNotification(NotificationSettings.Builder(application)
						.withoutModalInAppNotifications()
						.build())
expand to see Java code

new MobileMessaging.Builder(getApplication())
                .withoutCarrierInfo()
                .withoutSystemInfo()
                .withoutStoringUserData()
                .withoutStoringApplicationCode(new MyApplicationCodeProvider())
				.withDisplayNotification(new NotificationSettings.Builder(application)
					.withoutModalInAppNotifications()
					.build())
/**
 * Implementation of ApplicationCodeProvider interface in a class separate from the Activity
 */
class MyApplicationCodeProvider : ApplicationCodeProvider {
    override fun resolve(): String {
        // TODO fetch app code synchronously - no need for async API, code is already executed in a background thread
        return "some_app_code"
    }
}
expand to see Java code

/**
 * Implementation of ApplicationCodeProvider interface in a class separate from the Activity
 */
public class MyApplicationCodeProvider implements ApplicationCodeProvider {

    @Override
    public String resolve() {
        // TODO fetch app code synchronously - no need for async API, code is already executed in a background thread
        return "some_app_code";
    }
}

Descriptions

  • withoutCarrierInfo(): Method to opt-out of sending the carrier information to the server by MobileMessaging SDK. Default value is false.

  • withoutSystemInfo(): Method to opt-out of sending the system information such as OS version, device model, application version to the server by MobileMessaging SDK. Default value is false.

  • withoutStoringUserData(): Method to opt-out of storing the User Data locally. Persisting user data locally gives you quick access to the data and eliminates a need to implement the persistent storage yourself. Default value is false.

  • withoutStoringApplicationCode(ApplicationCodeProvider): Method to opt-out of storing application code locally (on disk) by MobileMessaging SDK. Use it when you want to take more care about privacy and don't want to store Application code in infobip_application_code string resource nor in our persistent storage, but would like to use it only from memory. In this case, you should provide it on demand. For example, you should implement sync API call to your server where you store required Application code and provide it to ApplicationCodeProvider.resolve() method as a return type. Sync (not async) API call should be used because we already handle your code in a background thread.

    Notice

    There might be situation when you want to switch between different Application Codes during development/testing. If you disable storing of Application Code, the SDK won't detect the Application Code changes, thus won't cleanup the old Application Code related data. You should manually invoke MobileMessaging.getInstance(Context).cleanup(); prior to start otherwise the SDK would not detect the Application Code change.

  • withPrivateSharedPrefs(): Deprecated at 6.0.0 version, all data saved to private preferences by default.

    Notice

    This method was introduced at 2.2.0 library version, switching from using this library version with private shared prefs back to MM SDK version < 2.2.0 is not backwards compatible since older SDK versions use just public prefs by default (and by using this method only private prefs are maintained)

  • NotificationSettings.Builder(this).withoutModalInAppNotifications().build(): Method to disable displaying of Basic Modal In-App and Full-featured In-App notifications. Since 9.0.0-rc version of SDK, Javascript is enabled for the webView for Full-featured In-App notifications' proper work, so you may disable In-Apps by calling this method.

Clone this wiki locally