foe*_*ens 7 android android-notifications google-play
我想创建一个通知,点击后,在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);
但是,单击时,没有任何反应.谁知道如何让这个工作?
发布的代码有效。我可能在使用 HTTP 版本的市场链接时遇到问题。喜欢http://play.google.com/store/apps/details?id=<package_name>。
| 归档时间: | 
 | 
| 查看次数: | 1585 次 | 
| 最近记录: |