android-notifications

Android: Is it possible to update a ImageView/ImageButton with a number to show the number of new messages?

冷暖自知 提交于 2019-11-27 03:54:18
In iOS we have a feature to update the app icon with the new pending messages for the user by showing a small number on the right-top corner of the icon and similarly I would like to know if we have method to update a ImageView/ImageButton in android(Here I am not looking to update the icon on the home screen but inside my app). For example, the pic shows the red background icon with the number of messages pending to be read in red and if there are no messages it shows with a gray background. Thanks, I was interested in this SO as I didnt know how to do it neither. So I started looking into it

How to implement the deprecated methods of Notification

落花浮王杯 提交于 2019-11-27 03:43:00
I have a small problem but dont understand how to get out of this. I created a class for providing Notifications, but these lines are marked deprecated: ... Notification notification = new Notification(icon, text, time); // deprecated in API level 11 ... notification.setLatestEventInfo(this, title, text, contentIntent); // deprecated in API level 11 ... Alternative methods are: ... Notification noti = new Notification.Builder(mContext) .setContentTitle("New mail from " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_mail) .setLargeIcon(aBitmap) .build(); // available

Show the Android Statusbar Notification in Particular date,

狂风中的少年 提交于 2019-11-27 03:40:14
问题 Help me to resolve this. Iam having Some Date in Local Database, Every day I Want to Check Database Date and Current Date in particular time,If database date is matching with current date Show notification in Statusbar I have added my code, signin-->MyNotificationService-->Scheduleclient-->ScheduleServcie-->AlarmTask-->NotifyService Flow, Here Once service is Started ,Database data is retrieving But condition Is not Checking every day. I Want to check local database Saved date & current date

NotificationListenerService Implementation

隐身守侯 提交于 2019-11-27 03:36:11
I am trying to implement NotificationListnerService which is added in android 4.3 but I am not able to get the notification details. My code are as below public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this); mBuilder.setSmallIcon(R.drawable.ic_launcher); mBuilder.setContentTitle("notification test"); mBuilder.setContentText("Notification text"); mBuilder.setAutoCancel(true); Intent

Firebase Messaging - Create Heads-Up display when app in background

空扰寡人 提交于 2019-11-27 03:24:53
问题 With FCM I receive push notifications in the system tray when the app is in the background or not running. When the app is in the foreground I can override onMessageReceived and create my own heads-up notification with NotificationCompat . Is there a way to create a heads-up notification when my app is in the background or not running? Thanks EDIT: For reference here is the message payload I am using via curl to https://fcm.googleapis.com/fcm/send { "to":"push-token", "content_available":

GCM Push Notification Large Icon size

泄露秘密 提交于 2019-11-27 03:20:20
问题 Hi Iam implementing Push Notifications in Android using GCM. I am trying to set an image for the notification instead of the default app icon. I am able to achieve this using the following code if(extras.getString("src") != null){ URL url = new URL(extras.getString("src")); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap large_icon = BitmapFactory.decodeStream

Do GCM registration id's expire?

空扰寡人 提交于 2019-11-27 03:15:28
I know that C2DM registrations expire, and you are supposed to periodically refresh the registration ID. Is this the case with GCM? by looking at the following code on the Android GCM guide (shown below), it seems like you only do it once and don't need to refresh, but I dont see that explicitly written anywhere, so I just wanted to check. final String regId = GCMRegistrar.getRegistrationId(this); if (regId.equals("")) { GCMRegistrar.register(this, SENDER_ID); } else { Log.v(TAG, "Already registered"); } EDIT: THIS ANSWER IS WAY OUT OF DATE, I HAVE NO IDEA WHAT THE CURRENT BEHAVIOR IS I found

Remove notification from notification bar from other applications

一世执手 提交于 2019-11-27 02:42:18
问题 I want to remove notifications from another application shown in the notification bar. Is that possible? NotificationManager.cancelAll(); cancels only notifications shown by the calling application, as far as I know. Why do I want to do this? I have an application that reads and sends SMS via a webpage, and I want this application to co-exits with existing SMS applications like Handcent SMS. The way I want it to work is that when reading newly received SMS via the webpage, I want to cancel

How to check if my app is allowed to show notification

别说谁变了你拦得住时间么 提交于 2019-11-27 02:04:50
问题 In Android settings users can turn off notification if they don't want to. So is there any method that like isNotificationAllowed() to check is my app is allowed to show notification? And how to open android setting page to guide my users to turn on notification? 回答1: EDIT - New Answer: Seems like google added the proper API call: NotificationManagerCompat.from(context).areNotificationsEnabled() OLD ANSWER: For anyone who is looking at this question, note that NotificationListenerService is

NotificationChannel issue in Android O

别说谁变了你拦得住时间么 提交于 2019-11-27 01:27:55
问题 I am getting a toast saying "Developer warning for package com.google.android.apps.messaging" when sending an MMS using Android Messages ver 2.3.063. In logs 08-12 16:57:52.368 7661 7682 W Notification: Use of stream types is deprecated for operations other than volume control 08-12 16:57:52.368 7661 7682 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case 08-12 16:57:52.369 1604 3146 E