通知单击时打开外部存储目录

时间:2016-09-18 11:37:27

标签: android notifications xamarin.android

我正在尝试在用户点击通知时打开外部存储目录,但没有任何反应。我就是这样做的:

Intent intent = new Intent(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath);

const int pendingIntentId = 0;
PendingIntent pendingIntent = PendingIntent.GetActivity(this, pendingIntentId, intent, PendingIntentFlags.CancelCurrent);

Notification.Builder builder = new Notification.Builder(this);
builder.SetContentTitle("...");
builder.SetContentText(notificationText);
builder.SetSmallIcon(Resource.Drawable.HgssLogoNotification);
builder.SetContentIntent(pendingIntent);

Notification.BigTextStyle textStyle = new Notification.BigTextStyle();
textStyle.BigText(notificationText);
textStyle.SetSummaryText("...");
builder.SetStyle(textStyle);

Notification notification = builder.Build();

NotificationManager notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);

const int notificationID = 0;
notificationManager.Notify(notificationID,notification);

我做错了吗?

感谢任何帮助。

0 个答案:

没有答案