parse.com - The method setDefaultPushCallback from the type PushService is deprecated using android -


i newbie in android. have been dealing problem of deprecated method @ push service using parse services. have followed similar question similar problem here can't solution. in main application class dealing problem, code given below one.

public class mapplication extends application {     private static mapplication minstance;      @override     public void oncreate() {         super.oncreate();          minstance = this;         parse.initialize(this, jni.stringfromjni001(), jni.stringfromjni010());          // specify activity handle pushes default.         pushservice.setdefaultpushcallback(this, mainlandingactivity.class); // setdefaultpushcallback shows deprecated method here..       parseacl defaultacl = new parseacl();         // optionally enable public read access.         defaultacl.setpublicreadaccess(true);         defaultacl.setpublicwriteaccess(true);         parseacl.setdefaultacl(defaultacl, true);      }      public static mapplication getinstance() {         return minstance;     }  } 

in manifest using one:

<service android:name="com.parse.pushservice" />           <receiver android:name="com.parse.parsebroadcastreceiver" >             <intent-filter>                 <action android:name="android.intent.action.boot_completed" />                 <action android:name="android.intent.action.user_present" />             </intent-filter>         </receiver> 

from link https://teamtreehouse.com/forum/app-crash-on-push-test saw have use following method, cant figure out how use , resolve problem.

public class receiver extends parsepushbroadcastreceiver {      @override     public void onpushopen(context context, intent intent) {         intent = new intent(context, mainactivity.class);         i.putextras(intent.getextras());         i.setflags(intent.flag_activity_new_task);         context.startactivity(i);     } } 

please me problem. appreciated.

yes, pushservice.setdefaultpushcallback() deprecated now. have create own subclass of parsepushbroadcastreceiver. in manifest file along default parse push receiver should declare receiver subclass following

 <receiver android:name="com.yourproject.yourreceiver" android:exported=false>     <intent-filter>         <action android:name="com.parse.push.intent.receive" />         <action android:name="com.parse.push.intent.open" />         <action android:name="com.parse.push.intent.delete" />     </intent-filter> </receiver> 

and receiver subclass should override 'getactivity()` method

protected class<? extends activity> getactivity(context context,                                 intent intent) {     return youractivity.class; } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -