Xamarin在通知点击上形成开放视图模型

时间:2017-03-08 17:40:09

标签: xamarin.android xamarin.forms mvvmcross

我正在使用此代码在通知栏中显示通知。点击通知后,将启动主要活动。是否可以使用MvvmCross在Xamarin表单应用程序中启动视图模型而不是活动。

 Intent notificationIntent = new Intent(context,typeof(MainActivity));
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |                                Intent.FLAG_ACTIVITY_SINGLE_TOP);      
   PendingIntent pIntent = PendingIntent.getActivity(context, code,
            notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationManager manager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    NotificationCompat.Builder notify = new NotificationCompat.Builder(
            context);

    notify.setContentIntent(pIntent);
    notify.setSmallIcon(R.drawable.app_icon);
    notify.setContentTitle(“Title”);
    manager.notify(reqCode, notify.build());

0 个答案:

没有答案