【发布时间】:2012-10-10 06:05:34
【问题描述】:
我为我的 android 应用程序集成了推送通知,我想为任何 android 手机/标签打开/关闭推送通知,谁能帮我...
protected void onPostExecute(BlogInfo result){
if(result.IsNew && result.Blog != null){
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.logo, "THE BUTCHER BARKS", System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_ALL;
Intent intent = new Intent(Service.this, Bark.class);
PendingIntent pendingIntent = PendingIntent.getActivity(GuruService.this, 0, intent, 0);
notification.setLatestEventInfo(getApplicationContext(), "BARKS", result.Blog.Title, pendingIntent);
manager.notify(1, notification);
}
}
【问题讨论】:
-
您的问题不清楚。你的意思是你想让你的用户选择打开还是关闭它?
-
根据您的代码,我认为这不是推送通知,而是简单通知。那么你想如何开始/停止通知呢?
标签: android notifications push-notification push server-push