jjzjj

notificationManager

全部标签

android - 为什么 "Activity Screen"在 Redmi 设备中从后台服务启动 Activity 时不显示最近的应用程序

在我的android应用程序中,我通过推送通知从后台启动我的服务。当我收到推送通知时,我使用以下代码唤醒我的Activity:Intentit=newIntent("intent.my.action");it.setComponent(newComponentName(context.getPackageName(),IncomingActivity.class.getName()));it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.getApplicationContext().startActivity(it);一旦我的Acti

android - 为什么 Eclipse 无法识别 Notification.Builder 类中的 build() 方法来返回 Notification 对象?

这是我的代码:NotificationManagermNotificationManager=(NotificationManager)c.getSystemService(ns);//InstantiatethenotificationCharSequencetickerText="Hello";longwhen=System.currentTimeMillis();Notification.Builderbuilder=newNotification.Builder(c).setTicker(tickerText).setWhen(when).setContentTitle("Te

android - 如何在Android中实现通知服务(不使用Activity)

我正在实现通知我的应用只是一个例子。服务类文件:publicclassServices{publicvoidmyNotify(Contextcontext,Stringmessage){Log.v("mynotificationmethod","fromGetNotificationclass");NotificationManagernotificationManager=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);Notificationnotification=newNot

安卓 : Unable to display multiple lines of text in Notification

我试图在通知中使用BigTextStyle显示多行文本,但无法这样做。我正在使用下面的代码。publicvoidsendNotification(Viewview){StringmsgText="JeallyBeanNotificationexample!!"+"whereyouwillseethreedifferentkindofnotification."+"youcanevenputtheverylongstringhere.";NotificationManagernotificationManager=getNotificationManager();PendingInten

java - 不能使用公共(public)静态方法?

这令人困惑。我在看Android2.2.2_r1sourcecodefortheNotificationManager类,我看到方法getService()被定义为public和static。然而,eclipse告诉我:ThemethodgetService()isundefinedforthetypeNotificationManageronthelineObjecto=NotificationManager.getService();我的项目是针对Android2.2/API级别8构建的。我尝试使用反射来查看方法名称和修饰符,果然,我回来了publicstaticgetServic

android - NotificationManager.notify 锁定手机和Emulator

问题:手机/模拟器锁定重复的通知更新。使模拟器在锁定后恢复响应的唯一方法是按给定顺序按Home=>Menu=>Lock=>Home=>MenuButton。代码:通知推送代码://SetupnotifcationviewsSharedPreferencessp=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());NotificationManagernotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERV

android - 如何在状态栏中显示通知?

所以我在我的Activity中创建了这个通知Notificationn=newNotification.Builder(getApplicationContext()).setContentTitle("Newmailfrom"+sender).setContentText(subject).setSmallIcon(R.drawable.notification).build();我现在如何在状态/通知栏中将其与声音一起显示? 最佳答案 有一些不错documentationatandroiddevelopersite看看Notif

android - 如何从 Activity 中一一显示通知警报列表?

我是android应用程序的新程序员,我想从Activity中一个一个地显示多个通知。我已经实现了一种获取通知的方法,如下所示publicvoidmyNotify(Stringmessage){Log.v("mynotificationmethod","fromGetNotificationclass");NotificationManagernotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);Notificationnotification=newNotification(R.

android - 为什么 NotificationManager 在更新过程中运行如此缓慢?

我通过NotificationManager发布文件上传进度,但在更新其进度UI时卡住。我使用缓存在类字段中的NotificationCompat.Builder。所以进度发布非常简单:manager.notify(id,uploader.setProgress(MAX_PROGRESS,(int)(progress*100),false).build());更新进度保证从主线程执行(包装在Handler装饰器中)。this.request.setCallback(newUploaderDecorator(this.request.getCallback()));现公布进展如下:lon

android - 当应用程序处于前台或后台时如何使用 FCM 处理通知

我使用firebase来构建我的项目。它还将使用FCM(firebase云消息)。但是有一个问题。当应用程序在后台时,我无法处理FCM(创建我的自定义通知)。Theofficialsitetutorial说情况1:应用程序前台->覆盖“onMessageReceived()”以创建您的自定义通知。案例二:App后台->系统会直接创建通知。我们不需要也不能做任何事情。因为在这种情况下它不会触发“onMessageReceived()”。但是,如果当应用程序处于后台时我什么也做不了,我就无法创建自定义通知。(例如,用户点击通知后,会弹出一个窗口显示详细信息。)那么当应用程序处于后台时,我如