草庐IT

NOTIFICATIONS

全部标签

android - 从通知启动服务

是否可以从通知启动服务。启动Activity的正常方式运行良好,但在实际启动应用程序之前我需要对数据进行一些预检查。我已经通过在通知Intent中包含一个有效的服务对其进行了测试,但没有任何反应。 最佳答案 Itispossibletostartaservicefromanotification.您必须使用PendingIntent.getService而不是pendingIntent.getActivity。IntentnotificationIntent=newIntent(mContext,HandleNotification

android - 从通知启动服务

是否可以从通知启动服务。启动Activity的正常方式运行良好,但在实际启动应用程序之前我需要对数据进行一些预检查。我已经通过在通知Intent中包含一个有效的服务对其进行了测试,但没有任何反应。 最佳答案 Itispossibletostartaservicefromanotification.您必须使用PendingIntent.getService而不是pendingIntent.getActivity。IntentnotificationIntent=newIntent(mContext,HandleNotification

android - 在 Android 8.1 API 27 上不显示通知

我在Android8.1API27上获得了Toast:Developerwarningforpackage"my_package_name"Failedtopostnotificationon...Logcat包含下一个字符串:Notification:UseofstreamtypesisdeprecatedforoperationsotherthanvolumecontrolW/Notification:SeethedocumentationofsetSound()forwhattouseinsteadwithandroid.media.AudioAttributestoqualif

android - 在 Android 8.1 API 27 上不显示通知

我在Android8.1API27上获得了Toast:Developerwarningforpackage"my_package_name"Failedtopostnotificationon...Logcat包含下一个字符串:Notification:UseofstreamtypesisdeprecatedforoperationsotherthanvolumecontrolW/Notification:SeethedocumentationofsetSound()forwhattouseinsteadwithandroid.media.AudioAttributestoqualif

android - 通知以恢复任务而不是特定 Activity ?

我有一个前台服务,只要用户登录到应用程序,它就会与服务器保持连接。这样可以使连接保持Activity状态,并且可以直接从服务器接收消息,即使用户按Home已将应用程序发送到后台。应用程序有许多Activity,当它被发送到后台时,其中任何一个都可能是Activity的。我想允许用户点击通知来恢复当前的Activity。我了解如何恢复特定Activity,但想知道是否有办法恢复用户上一个Activity?当然我可以跟踪最后一个,然后从Notification回调中调用它,但认为在任务级别可能有办法?感谢您提供的任何建议。 最佳答案 您

android - 通知以恢复任务而不是特定 Activity ?

我有一个前台服务,只要用户登录到应用程序,它就会与服务器保持连接。这样可以使连接保持Activity状态,并且可以直接从服务器接收消息,即使用户按Home已将应用程序发送到后台。应用程序有许多Activity,当它被发送到后台时,其中任何一个都可能是Activity的。我想允许用户点击通知来恢复当前的Activity。我了解如何恢复特定Activity,但想知道是否有办法恢复用户上一个Activity?当然我可以跟踪最后一个,然后从Notification回调中调用它,但认为在任务级别可能有办法?感谢您提供的任何建议。 最佳答案 您

android - 应用关闭时推送通知

您知道当应用程序完全关闭时是否可以接收来自谷歌云消息的通知?我知道它是打开的还是在后台,是的,但是可以通过任何方式对其进行编程以接收它们吗?编辑:当应用程序关闭时,我会继续,但不会收到通知。我附上了代码以防万一我没有看它。list广播接收器packagecom.something;importandroid.app.NotificationManager;importandroid.app.PendingIntent;importandroid.content.Context;importandroid.content.Intent;importandroid.os.Bundle;im

android - 应用关闭时推送通知

您知道当应用程序完全关闭时是否可以接收来自谷歌云消息的通知?我知道它是打开的还是在后台,是的,但是可以通过任何方式对其进行编程以接收它们吗?编辑:当应用程序关闭时,我会继续,但不会收到通知。我附上了代码以防万一我没有看它。list广播接收器packagecom.something;importandroid.app.NotificationManager;importandroid.app.PendingIntent;importandroid.content.Context;importandroid.content.Intent;importandroid.os.Bundle;im

android - NotificationCompat 4.1 SetSmallIcon 和 SetLargeIcon

我使用这个简单的代码在Android4.1或更高版本中设置通知。它运作良好,但我的问题来自SmallIcon和LargeIcon。我了解SmallIcon显示在状态栏中,LargeIcon显示在下拉列表中。NotificationCompat.Builderbuilder=newNotificationCompat.Builder(this);builder.setTicker("Theticker");builder.setContentTitle("Thetitle");builder.setContentText("Thetext");builder.setSmallIcon(R

android - NotificationCompat 4.1 SetSmallIcon 和 SetLargeIcon

我使用这个简单的代码在Android4.1或更高版本中设置通知。它运作良好,但我的问题来自SmallIcon和LargeIcon。我了解SmallIcon显示在状态栏中,LargeIcon显示在下拉列表中。NotificationCompat.Builderbuilder=newNotificationCompat.Builder(this);builder.setTicker("Theticker");builder.setContentTitle("Thetitle");builder.setContentText("Thetext");builder.setSmallIcon(R