我正在尝试使用Android Edk启动申请表格通知。我成功地显示了通知。但我想从通知中启动我的应用程序,我不能让它工作。 应用程序未运行时收到通知,由broadCast接收方触发 我认为我的问题与我通过通知意图创建的活动有关。
这里是通知功能:
Intent resultIntent = new Intent(context, TaskManagerActivity.class);
resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent resultPendingIntent = PendingIntent.getActivity( context, 0, resultIntent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context )
.setSmallIcon(R.drawable.ic_menu_day)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(resultPendingIntent)
.setWhen(System.currentTimeMillis());
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, mBuilder.build());
这是我的活动课程:
公共类TaskManagerActivity扩展了Activity {
public static TaskManagerActivity m_Activity;
private static final String TAG = "TaskManagerActivity";
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
}
}