我想创建一个通知,单击该通知会在 Android 市场上打开我的应用程序。
我尝试了几件事,如下所示:
NotificationCompat.Builder builder = new NotificationCompat.Builder(application);
builder.setAutoCancel(true);
// (set titles, icon, ...)
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.example"));
builder.setContentIntent(PendingIntent.getActivity(application, 0, intent, 0));
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) application.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
但是,单击时,没有任何反应。有谁知道如何让它工作?