Snehil Chouhan
Snehil Chouhan

Reputation: 119

Pusher in android not working

I am new to pusher , I just want to send notification message to android app . I created new app from pusher account and then putted code (that was given on Getting Started tab) , to my android app and server code to my rails server .

But now when I send event from Debug Console , on Getting started page there it shows on dialog "Hello" , but on my android app it doesn't show any message . Here is my android code .

Pusher pusher = new Pusher("MY_APP_KEY");

    Channel channel = pusher.subscribe("test_channel");

    channel.bind("my_event", new SubscriptionEventListener() {
        @Override
        public void onEvent(String channelName, String eventName, final String data) {
            System.out.println(data);
            a.setText(data);
        }
    });

    pusher.connect();

Am I doing everything correct or not ?

Does it show message in app on sending event from Debug Console on pusher website ?

Upvotes: 0

Views: 947

Answers (2)

Gustavo Zanardini
Gustavo Zanardini

Reputation: 116

I know it might be late, but I was having the same issue.

Make sure you have added

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

to your AndroidManifest.xml

It worked for me.

Upvotes: 2

Fabian valencia
Fabian valencia

Reputation: 132

Did you set a cluster on the getting started? If you did, then your android app should include something like this:

PusherOptions options = new PusherOptions();
options.setCluster("YOUR_SELECTED_CLUSTER");
Pusher pusher = new Pusher("YOUR_APP_ID",options);

Upvotes: 0

Related Questions