Search in sources :

Example 1 with MobileMessaging

use of org.infobip.mobile.messaging.MobileMessaging in project mobile-messaging-sdk-android by infobip.

the class MainActivity method initializeMobileMessaging.

private MobileMessaging initializeMobileMessaging() {
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        String[] permissions = { Manifest.permission.ACCESS_FINE_LOCATION };
        ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE);
        return null;
    }
    MobileMessaging mobileMessaging;
    MobileMessaging.Builder builder = new MobileMessaging.Builder(getApplication()).withMessageStore(SQLiteMessageStore.class).withoutStoringUserData();
    boolean notificationsEnabled = getNotificationEnabledFromPreferences();
    if (!notificationsEnabled) {
        mobileMessaging = builder.withoutDisplayNotification().build();
    } else {
        mobileMessaging = builder.withDisplayNotification(new NotificationSettings.Builder(this).withMultipleNotifications().withDefaultIcon(R.drawable.ic_notification).build()).build();
    }
    readMsisdnFromMobileMessaging();
    updateCount();
    return mobileMessaging;
}
Also used : MobileMessaging(org.infobip.mobile.messaging.MobileMessaging) SQLiteMessageStore(org.infobip.mobile.messaging.storage.SQLiteMessageStore)

Aggregations

MobileMessaging (org.infobip.mobile.messaging.MobileMessaging)1 SQLiteMessageStore (org.infobip.mobile.messaging.storage.SQLiteMessageStore)1