| | |
| | | |
| | | |
| | | private static void jump(Activity context, String type, String activity, String params) { |
| | | Log.i(TAG, "推送事件跳转"); |
| | | pushData = null; |
| | | Log.i(TAG, String.format("%s:%s:%s", type, activity, params)); |
| | | JumpDetail jumpDetail = new JumpDetail(); |
| | |
| | | super.onCreate(savedInstanceState); |
| | | mTextView = new TextView(this); |
| | | setContentView(mTextView); |
| | | init(getIntent()); |
| | | } |
| | | |
| | | private void init(Intent intent) { |
| | | String activity = getIntent().getStringExtra("activity"); |
| | | String params = getIntent().getStringExtra("params"); |
| | | String type = getIntent().getStringExtra("type"); |
| | |
| | | builder.append("params:" + params); |
| | | mTextView.setText(builder.toString()); |
| | | if (!isAppRunning(getApplicationContext(), getPackageName())) { |
| | | Log.i(TAG, "当前应用没有运行"); |
| | | //暂存数据 |
| | | pushData = new PushData(type, activity, params); |
| | | Intent intent = new Intent(this, MainActivity.class); |
| | | startActivity(intent); |
| | | Intent intent1 = new Intent(this, MainActivity.class); |
| | | startActivity(intent1); |
| | | finish(); |
| | | } else { |
| | | Log.i(TAG, "当前应用在运行"); |
| | | jump(this, type, activity, params); |
| | | finish(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onNewIntent(Intent intent) { |
| | | super.onNewIntent(intent); |
| | | Log.i(TAG, "onNewIntent"); |
| | | init(intent); |
| | | } |
| | | |
| | | private boolean isAppRunning(Context context, String packageName) { |
| | | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |