Mustafa Güven
Mustafa Güven

Reputation: 15744

Urban airship throws notification automatically

I'll explain the situation step by step

  1. I've implemented urban airship following the guide

  2. When a message comes from server my app shows a notification automatically which is what I don't want

  3. What I want is to handle the message comes from the server and be able to show my notification manually

  4. In order to do that I've added broadcastreceiver as documentation says and it works

  5. However now my app shows 2 notification at the same time

  6. I could not disable the notification which appears by the system automatically

Upvotes: 1

Views: 91

Answers (1)

Mustafa Güven
Mustafa Güven

Reputation: 15744

in order to solve the problem

  1. Create a custom NotificationFactory

  2. set it like below

    UAirship.takeOff(this, options, new UAirship.OnReadyCallback() {
        @Override
        public void onAirshipReady(UAirship airship) {
            airship.getPushManager().setUserNotificationsEnabled(true);
            airship.getInAppMessageManager().setDisplayAsapEnabled(true);
            UrbanAirNotificationFactory factory = new UrbanAirNotificationFactory(getApplicationContext());
            airship.getPushManager().setNotificationFactory(factory);
        }
    });
    

Upvotes: 2

Related Questions