MfrMessageActivity.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.edufound.mobile.push;
  2. import android.app.Activity;
  3. import android.app.AlertDialog;
  4. import android.content.DialogInterface;
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.text.TextUtils;
  8. import com.edufound.mobile.R;
  9. import com.umeng.message.UmengNotifyClickActivity;
  10. import org.android.agoo.common.AgooConstants;
  11. import org.cocos2dx.javascript.util.Logger;
  12. public class MfrMessageActivity extends UmengNotifyClickActivity {
  13. Activity mActivity;
  14. @Override
  15. protected void onCreate(Bundle bundle) {
  16. super.onCreate(bundle);
  17. // setContentView(R.layout.activity_push);
  18. mActivity = this;
  19. }
  20. @Override
  21. public void onMessage(Intent intent) {
  22. super.onMessage(intent);
  23. Bundle bundle = intent.getExtras();
  24. if (bundle != null) {
  25. Logger.e("bundle: " + bundle);
  26. }
  27. String body = intent.getStringExtra(AgooConstants.MESSAGE_BODY);
  28. Logger.e("body: " + body);
  29. if (!TextUtils.isEmpty(body)) {
  30. // runOnUiThread(() -> ((TextView) findViewById(R.id.tv)).setText(body));
  31. AlertDialog.Builder builder = new AlertDialog.Builder((this));
  32. builder.setMessage(body);
  33. builder.setTitle("消息通知");
  34. builder.setNegativeButton("确定", new DialogInterface.OnClickListener() {
  35. @Override
  36. public void onClick(DialogInterface dialog, int which) {
  37. dialog.dismiss();
  38. mActivity.finish();
  39. }
  40. });
  41. }
  42. }
  43. }