android-notifications

How to make an image fit a custom 256dp Big Picture Notification in Android?

半世苍凉 提交于 2019-12-07 15:50:19
问题 I'm trying to fit (center and inside) 2 kind of images obtained from web services in a Big Picture styled Notification. One kind is 97px*150px sized and the other 300px*100px. As I checked the image must fit 256dp tall max height to fit on Jelly Bean's Big Picture notification visual area, so I expected that I can call the matrix scales availables on ImageView (fitXT, centerInside, etc) but i'm surprised that no scaling method behavior is available to configure and the bitmap is always center

error when building a notification

∥☆過路亽.° 提交于 2019-12-07 13:53:19
问题 I am using this tutorial http://www.vogella.com/articles/AndroidNotifications/article.html , I want to build notification // Prepare intent which is triggered if the // notification is selected Intent intent = new Intent(this, NotificationReceiver.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); // Build notification // Actions are just fake Notification noti = new Notification.Builder(this) .setContentTitle("New mail from " + "test@gmail.com") .setContentText(

Group notifications on Android

痴心易碎 提交于 2019-12-07 12:43:25
I want to show notifications like on picture. If there is more than one, I want to show a counter too. I didn't find info in official doc. Now I just update my notification by id: ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(PUSH_NOTIFICATION_ID, notification); How can I do it ? NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext()); mBuilder.setSmallIcon(R.mipmap.ic_launcher); mBuilder.setContentTitle(topic); mBuilder.setContentText(new String(message.getPayload())); mBuilder.setAutoCancel(true); mBuilder.mNumber

Get text from expanded notification in status bar?

二次信任 提交于 2019-12-07 07:19:16
问题 Is it possible to get the text within an expanded notification in the statusbar ? This means text set my Notification.BitTextStyle.bigText() , such as in an email notification from Gmail. I would like to get it using Notification.extras but there seems to be no constant, such as Notification.EXTRA_BIG_TEXT for example, that allows this to work. Is there another way of getting this text? Furthermore when I use String bigTitle = mExtras.getString(Notification.EXTRA_TITLE_BIG; it returns null ,

Programmatically ending an ongoing notification - Android

大兔子大兔子 提交于 2019-12-07 06:43:14
问题 I am developing a GPS-based app and have just started adding in my UX features such as notifications and progress bars but I'm stuck on using an ongoing notification. As it is a GPS app, when user tracking is started, I set up an ongoing notification to show that they are being tracked but how do I stop this notification when they tap "stop tracking" in my app? Do I have to tell the NotifyManager something? I'm basically trying to get the functionality that music players have, as in the

Call service method from notification with BroadcastReceiver in Xamarin Android

妖精的绣舞 提交于 2019-12-07 06:08:25
I start a service and create new thread (downloading a large file). At the same time I display a notification with action (pause button). When I press this button "WSTRZYMAJ" I want call PauseDownload() method from my service. How can I do this? I have read about BroadcastReceiver, create this class but how to call method from service from BroadcastReceiver class? Screen from notification: Fragment of my service: class DownloadsService : Service { DownloadsBroadcastReceiver receiver; Notification.Builder notificationBuilder; DownloadsData downloadsData; int uniqueNumber = 1000; bool isStarted;

How to make lock screen notification for media player

孤街浪徒 提交于 2019-12-07 05:09:39
问题 I am trying to get lock screen in the mobile I am able to get every thing work like notification and other things of my app but when I try to display the lock screen it is not working at all for android M. private void initMediaSession() throws RemoteException { if (mediaSessionManager != null) return; //mediaSessionManager exists ComponentName mediaButtonReceiver = new ComponentName(getApplicationContext(), MediaButtonReceiver.class); mediaSession = new MediaSessionCompat

Background image for android wear notification

僤鯓⒐⒋嵵緔 提交于 2019-12-07 04:10:40
问题 I want to set background image for Android Wear notification. What should be the size of the image? 回答1: The resolution for square watch faces as of right now is 280x280, whereas the circular watch face has a resolution of 320x320 (although some of this will be cut off, obviously). However, Android Wear implements a sort of parallax scrolling by default for larger images, so it can handle larger images with great ease, and it is even recommended that you do so (see this previous answer). So

Intent to open the Notification Channel settings from my app

房东的猫 提交于 2019-12-07 03:19:25
问题 What's the Intent that I need to send to open the settings of a Notification Channel that I've previously created in my app? I need it to link from my settings activity. 回答1: To open the settings for a single channel, you can use ACTION_CHANNEL_NOTIFICATION_SETTINGS: Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()) .putExtra(Settings.EXTRA_CHANNEL_ID, yourChannelId); startActivity(intent); Using ACTION

How to update Notification

我只是一个虾纸丫 提交于 2019-12-07 00:42:26
I have a Notification in my android application. And this Notification has a progress bar. My question is: if I update progress in the progress bar of my Notification , should I pass the SAME instance of Notification or create a new instance of Notification ? should I do this: mNotification = new Notification(..); // create in the constructor of my activity getNotificationManager().notify(TAG, FILE_UPLOAD_ID, mNotification); or getNotificationManager().notify(TAG, FILE_UPLOAD_ID, new Notification(...) ); The same. public void notify (String tag, int id, Notification notification) Since: API