草庐IT

NOTIFICATION

全部标签

android - Android 前台不显示推送通知

我在android和iPhone中使用react-native-fcm进行远程通知。react-native-fcm在Android前台我无法在通知栏中获取远程通知。在后台模式下,我能够成功获得通知,但有些在前台模式下却没有。安卓list.xmlApp.jsasynccomponentDidMount(){//createNotificationChannelforfutureuse!FCM.createNotificationChannel({id:'my_default_channel',name:'Default',description:'usedforexample',pri

android - broadcastReceiver 可以捕获多个广播吗?

我正在尝试创建多个接近警报,但我无法让它工作...我认为广播接收器被覆盖,因此只处理最后一个广播。因此,如果我只有两个点靠近最后创建Intent的那个点,则会生成警报...我读到我应该使用请求代码,但我不知道该怎么做...我设置挂起Intent和广播接收器的方法...privatevoidaddProximityAlert(doublelatitude,doublelongitude,StringpoiName,Stringintentfilter){Bundleextras=newBundle();extras.putString("name",poiName);Intentinte

android - 选择通知时取消Android中的动态通知

假设我正在创建一个类似于SMS应用程序的Android应用程序。要求如下:用户可以收到多个通知,每个通知都有一个int类型的动态ID。选择通知后,它会加载显示相应消息(SMS)的Activity。选择的单个通知应自动关闭。关于如何处理这个问题,我的想法是使用putExtra将整数ID添加到Intent中,然后可以从它加载的Activity中的Intent访问它,然后关闭调用它的通知。对于我的测试用例,这里是规范:通知最终会从服务生成,现在他们在测试时产生用户按下按钮。选择通知后,称为Activitytoast消息,然后试图驳回通知。(为了能见度)这是我的问题:当第一个通知是选了,就对了

android - 更新通知区的进度条

关于如何在通知栏中制作自定义布局,已经有多个主题。问题是我一定遗漏了一些简单的东西。我有一个custom_notification_layout.xml我还有一些创建通知的测试代码,它可以工作并显示进度条。NotificationManagermManager=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);Notificationnotification=newNotification(R.drawable.icon,title,System.currentTimeMillis()

Android - 如何创建永久通知

我已经在我的“onCreate”Activity方法中创建了一个通知。一切运行顺利,只是您可以通过按“全部删除”按钮将其关闭。如何使此通知永久化?因为它应该只是更多的信息而不是通知..这是我当前的代码:privatevoidshowNotification(){//TODOAuto-generatedmethodstubnMN=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);Notificationn=newNotification.Builder(this).setContentTitle("WhipAndWee

java - Android 8.1 带通知 : Use of stream types is deprecated

只要我的服务正常运行,我的状态栏中就会保留FLAG_ONGOING_EVENT通知,并且它每秒都会更新时间。Android8之后,我添加了NotificationChannel8和8+设备都运行良好,但是8+设备每秒都在我的logcat中填充以下警告,这非常烦人:04-1020:36:34.04013838-13838/xxx.xxxx.xxxxW/Notification:UseofstreamtypesisdeprecatedforoperationsotherthanvolumecontrolSeethedocumentationofsetSound()forwhattousei

android - 如何在状态栏上设置文本?

如何在状态栏上设置文本(放置电池生命周期、时间等的行)?提前致谢。 最佳答案 您需要使用StatusBarNotification.//CreatetheNotificationNotificationnotification=newNotification(android.R.drawable.stat_sys_warning,//Icontouse"HelloWorld!",//TextSystem.currentTimeMillis()//Whentodisplay-i.e.now);//CreateaPendingInten

android - 如何从通知中触发广播接收器?

我想从通知中触发广播接收器。当我点击通知上的按钮时,它会显示此错误:"Unabletoinstantiatereceivercom.example.testservice.myBroad:java.lang.ClassCastException:com.example.testservice.myBroadcannotbecasttoandroid.content.BroadcastReceiver"**已更新/编辑并且现在可以使用**你能帮忙处理从通知到广播接收器的2个按钮吗?我如何将额外的值从通知广播触发器传递给接收器,无论它的播放按钮是按下还是暂停?现在我的按钮可以工作了,但是当

android - 更新Google play服务到8.4.0推送通知后自己显示

这个问题在这里已经有了答案:GooglePlayServices8.4.0breaksGoogleCloudMessagingforAndroidifiOSisalsoused(3个答案)关闭6年前。对于推送通知,我们使用GCM(GoogleCloudMessaging)。当我们使用play-services:8.3.0时它工作正常。我们使用自己的接收器处理推送通知。升级到com.google.android.gms:play-services:8.4.0后推送不会出现在我的myGcmListenerService中,而是在通知栏中自行显示。它还在日志中显示此错误GcmAnalytic

android - 尽管创建了 channel ,但通知未显示在 Android O 中

这是我在下面给出的代码。这无法在AndroidO上创建任何通知,尽管创建了通知channel。privatevoidweatherNotification(WeatherInfoweather){Intentintent=newIntent(this,WeatherActivity.class);PendingIntentpendingIntent=PendingIntent.getActivity(this,0,intent,0);StringtemperatureScale=prefs.getUnits().equals("metric")?getString(R.string.c