parse.com - how to update the subscribed channel for push notifications from parse in android programatically -


i using parse push notifications. so, did is, subscribed channel named "everyone" while initilizing parse application id , client key.

the code goes in application class's oncreate() method:

    // initialize crash reporting.     parsecrashreporting.enable(this);      // enable local datastore.     parse.enablelocaldatastore(this);      // add initialization code here     parse.initialize(this, application_id, client_key);      parseuser.enableautomaticuser();      parsepush.subscribeinbackground("everyone", new savecallback()     {           @override           public void done(parseexception e)           {                 if (e == null)                 {                   log.d("from parseapplication", "successfully subscribed broadcast channel.");                 }                 else                 {                   log.e("from parseapplication", "failed subscribe push", e);                 }           }     });      parseinstallation.getcurrentinstallation().saveinbackground(); 

and sending push notificaiton app:

jsonobject obj;

    try     {         obj = new jsonobject();         obj.put("action","app.package.name.pushnotification");         obj.put("customdata","message comes here");         obj.put("time", system.currenttimemillis());          parsepush push = new parsepush();         parsequery<parseinstallation> query = parseinstallation.getquery();          query.whereequalto("channels", "everyone");         push.setquery(query);         push.setdata(obj);         push.sendinbackground(new sendcallback()         {                @override             public void done(parseexception arg0)             {                 if(arg0 == null)                 { 

// finish(); log.d("if arg0", "arg0: "+arg0);

                    toast.maketext(this, "push notificaiton sent", toast.length_short).show();                 }                 else                 {                     log.d("else arg0", "arg0: "+arg0);                      toast.maketext(this, "failed send push notificaiton", toast.length_short).show();                 }             }         });     }     catch (jsonexception e)     {         e.printstacktrace();     } 

because of this, ever install application, every 1 gets push notification because of query: query.whereequalto("channels", "everyone");

so, want update/delete subscribed channel "everyone" "individualone" or "individualtwo" different name(s) programmatically, can send push notifications selected ones rather every 1 changing query: query.whereequalto("channels","individualtwo");

can me out in this..

thank in advance..


Comments