Android 安装软件后执行“OPEN”引起的Intent血案(系统BUG)(二)

2014-11-24 07:29:21 · 作者: · 浏览: 10
nentName componentName = new ComponentName(context, TestActivity.class);
intent.setComponent(componentName);

intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);

PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification notification =
new Notification(iResIcon,sNotifybar, System.currentTimeMillis());
notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
notification.defaults =
/*Notification.DEFAULT_SOUND|*/Notification.DEFAULT_LIGHTS;
notification.setLatestEventInfo(context, from, message, contentIntent);
nm.notify(R.string.app_name, notification);
}
@Override
protected void onStart()
{
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onResume()
{
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected void onStop()
{
// TODO Auto-generated method stub
super.onStop();
}
@Override
protected void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
}
}