Jack
Jack

Reputation: 172

Set Up Parse Push Notifications for Android

I am trying to set up push notifications for Android using Parse and I can't seem to get past initializing it within the application.

I think I might be missing something.

I get the error message

java.lang.RuntimeException: Unable to start activity ComponentInfo{package_name/...MainActivity}: java.lang.IllegalArgumentException: Must subscribe to channel with a valid icon identifier.

but i don't know what 'Must subscribe to channel with a valid icon identifier' means. I have tried a few different channel names and callback activities.

public class GlobalState extends Application {

    private static final String PARSE_APP_ID = ...;
    private static final String PARSE_CLIENT_KEY = ...;

    public void onCreate() {

        Parse.initialize(this, PARSE_APP_ID, PARSE_CLIENT_KEY);

        // Enable the Parse push notification service for remote pushes.
        PushService.subscribe(this, "channel", MainActivity.class);
        PushService.setDefaultPushCallback(this, MainActivity.class);

    }
}

I would really appreciate any help!

Upvotes: 1

Views: 476

Answers (1)

Jack
Jack

Reputation: 172

I FIGURED IT OUT

i finally took the error message literally:

Must subscribe to channel with a valid icon identifier.

and i was missing android:icon="@drawable/ic_launcher" attribute from the <application> field in the AndroidManifest.xml file. once i added it, notifications worked fine. seems really obvious in hindsight

Upvotes: 3

Related Questions