build.gradlesourcesets { main.jni.srcDirs = [] main.jniLibs.srcDirs = [' Libs ']}
public class MyApplication Extendsapplication { publicvoidoncreate () { super.oncreate (); Jpushinterface.setdebugmode (true); Jpushinterface.init (this);} }
public class Myreceiver extends Broadcastreceiver { @Override publicvoidonreceive (context context, Intent Intent) { System.out.println ("received the message .... "); Bundle bundle = Intent.getextras (); String type = bundle.getstring (Jpushinterface.extra_extra); System.out.println ("received the message = = = =" +type);} }
When the user clicks on the processing
else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals (Intent.getaction ())) {LOG.D (TAG, "[myreceiver] user point hit Notice "); LOG.D (TAG, "[Myreceiver] user clicked Open the notification:" + bundle.getstring (Jpushinterface.extra_extra)); try {String json = bundle.getstring (Jpushinterface.extra_extra); Jsonobject jsonobject = new Jsonobject (JSON); String Newsurl = jsonobject.optstring ("Newsurl"); if (Textutils.isempty (Newsurl)) {Newsurl = "http://10.0.2.2:8080/zhbj/10012/724D6A55496A11726628.html"; }//Open the custom activity Intent i = new Intent (context, newsdetailactivity.class); I.putextra ("url", newsurl);//I.putextras (bundle); I.setflags (Intent.flag_activity_new_task); I.setflags (Intent.flag_activity_new_task | Intent.flag_activity_clear_top); Context.startactivity (i); } catch (JSONexception e) {e.printstacktrace (); }
Silicon Valley News 11--Aurora Push Integration