草庐IT

NOTIFICATION

全部标签

来自通知的 Android 刷新 Activity

我有一个调用通知的程序。通知,如果你把它拉下来,启动一个新的Activity。mNotificationManager=(NotificationManager)getSystemService(ns);inticon=R.drawable.stat_sys_secure_green;CharSequencetickerText="BrowserSecurityEnabled";longwhen=System.currentTimeMillis();notification=newNotification(icon,tickerText,when);Contextcontext=get

android - 解析推送 - 如何在 Android 上接收推送时自动打开 Activity 而无需用户操作

我有一个要求(android),当用户没有点击系统托盘中的通知而收到推送通知时,我的应用程序应该自动运行其主要Activity。我有一张显示当前位置的map,但在推送中,我会收到一个位置,我需要在主要Activity中使用我的map,以便在收到推送时将相机移动到当前收到的位置,并提醒用户自定义声音。所有这一切都应该在用户不点击任何东西的情况下发生。请帮助。提前致谢。 最佳答案 是的,这是可能的。Parse.com文档说:YoucanalsospecifyanIntenttobefiredinthebackgroundwhenthep

android - 尽管手机静音,但有声音通知

我正在使用Android的NotificationManager创建通知。是否可以通过始终播放通知声音的方式“覆盖”手机的音量(静音)设置?我需要这个的原因如下:通知非常重要,单靠振动可能还不够。必须提醒用户。因此,即使手机处于静音状态或音量非常低,也应该播放声音。 最佳答案 是的,这是可能的,MediaPlayermMediaPlayer;Urinotification=null;notification=RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);mMedi

android - Urban Airship : custom icon for default status bar notification

如果您想对状态栏通知进行任何修改,包括微调图标,UrbanAirship建议使用CustomPushNotificationBuilder创建自定义通知。不幸的是,使用RemoteView进行通知会带来许多与自定义制造商和/或特定于平台的皮肤相关的不良影响,includingtextcolors以及对私有(private)资源的引用(例如Honeycomb/ICS上的@*android:drawable/notify_panel_notification_icon_bg_tile)。必须有一种无需使用RemoteView即可交换图标的简单方法。怎么办? 最佳

android - 如何在Android应用程序中点击后隐藏通知

这是在服务开始时发出通知的代码NotificationCompat.Buildermbuild=newNotificationCompat.Builder(getApplicationContext());Intentin=newIntent(getApplicationContext(),MainActivity.class);PendingIntentresultIN=PendingIntent.getActivity(getApplicationContext(),code,in,NOTIFICATION_COUNT);mbuild.setSmallIcon(R.drawable

android - setLatestEventInfo() 无法在 Android Studio 中解析

我在AndroidStudio中工作并尝试在特定日期和时间生成通知。一切正常,但是,在我的服务类setLatestEventInfo()方法中无法解析。我在eclipse中做过同样的演示,eclipse没有任何问题。我不想在任何按钮的点击或任何手动事件生成时生成通知,而是在我指定的特定日期和时间生成通知。服务类代码如下:publicclassMyRemiderServiceextendsService{privateNotificationManagermManager;@OverridepublicIBinderonBind(Intentintent){returnnull;}@Ov

android - 即使在使用 AUTOCANCEL 后单击通知后也无法删除 Android Lollipop 中的通知

我的应用程序的主题是使用PushNotification使用GoogleCloudMessaging向用户发送商店中有新优惠的通知privatevoidsendNotification(Contextcontext,Stringmessage){SharedPreferencesmPrefs=getSharedPreferences("MYAPP",Context.MODE_PRIVATE);intuniqueNumber=this.getSharedPreferences("MYAPP",Context.MODE_PRIVATE).getInt("uniqueNumber",0);L

android - 远程 View 中具有动态布局的自定义通知

我在远程View中使用动态布局而不是xml布局创建自定义通知,但最终出现以下错误。03-1214:42:59.907:E/AndroidRuntime(2399):android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.example.notificationexample:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.example.notificationexampleid=0tag=nullscore=0notn=Notif

android - 设置单行android通知(只有标题)

我想在通知抽屉中为我的应用程序设置一个通知,但其中只有一个标题(没有正文),意思是-只有一行通知,应该与应用程序图标垂直对齐。例如,在下面的通知中,我只想保留“Ringershushed'til19:16”标题,字体大小相同,但垂直居中于左侧的应用程序图标。这是我创建通知的代码:NotificationManagermanager=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);PendingIntentcontentIntent=PendingIntent.getActivity(

java - 通知在特定时间自动取消

我是Java编码的初学者,目前正在编写Android项目。现在,我面临一个问题。我希望我的application在特定时间自动删除notification。在用户点击notification后,我设法关闭了notification。然而,与此同时,如果用户没有对notification使用react,我也希望notification在特定时间后自动消失。请告诉我应该怎么做。如果可能,请给我一些例子。 最佳答案 您可以在调用显示通知的方法后立即启动所需秒数的计时器,并在计时器的onFinish()内部添加如下内容:Notificati