Silicon Valley News 11-Aurora push integration, Silicon Valley News 11-Aurora
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 message ===" + type );}}
Processing when users click
Else if (JPushInterface. action_icationication_opened.equals (intent. getAction () {Log. d (TAG, "[mycycler] the user clicks open notification"); Log. d (TAG, "[mycycler] the user clicked to 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/724 d6a55496a11116628.html";} // open the custom Activity Intent I = new Intent (context, 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 ();}