android-notifications

Onclick listener for Notification buttons in android

情到浓时终转凉″ 提交于 2019-12-06 04:34:54
I have created a notification with a button for API versions more than 16. Notification and button are coming up properly. I would like to dismiss the notification on clicking the button or notification. On clicking the notification the notificiation gets cleared but it is not the same when I click on the button it doesn't do anything. I am not sure how to listen to button click on Notification? Can somebody help me fix this? Look at the screen shot... So when I click on AndroidProject - The notification is cleared and an intent is called accordingly, but when I click on Close or the red X

Android - Set notification to never go away

谁说我不能喝 提交于 2019-12-06 04:20:52
I have this code that works great: Notification n = builder.build(); n.flags = Notification.FLAG_NO_CLEAR; But when I restart the phone, the notification goes away. Is there any flag that make that happen? If you want to print notification when the device boots up, you can create a receiver that is invoked when the system boot is completed, for this, first create a receiver, public class MyReciever extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Log.d("BOOT COMPLETE","SERVICE CALLED>>>>>>>>>>>>"); //use your code here to print notifications } } This

error when building a notification

时光怂恿深爱的人放手 提交于 2019-12-06 03:44:07
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("Subject") .setSmallIcon(R.drawable.icon) .setContentIntent(pIntent) .addAction(R.drawable.icon, "Call",

How to open the main app from the wearable?

☆樱花仙子☆ 提交于 2019-12-06 02:00:00
问题 I'm playing a little with wearables, I already created notifications from my micro app (which runs on the wearable ) with some little restrictions and I'm wondering how I can create a pending intent for an action to open the main app on the phone. 回答1: My solution that I've just tested and it works is add a message listener on the Android application and simply send from the wearable the details of what I want it to do. public class WearMessagesAPI_Service extends WearableListenerService {

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

可紊 提交于 2019-12-06 00:24:12
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-cropped wich by the way is worst default matrix behavior I would selected for default because images

How to set a bigger icon in Firebase app notification?

这一生的挚爱 提交于 2019-12-05 23:14:51
问题 Hi i am implementing Push Notifications in Android using Firebase. Now, there is a small icon showing inside one circle. I need it to show in bigger size. Please see the image. And here is my code, android:id="@+id/relativeNotification" android:layout_width="192dp" android:layout_height="192dp" android:layout_alignParentEnd="true" android:layout_alignParentRight="true"> <com.inspius.coreapp.widget.TintableImageView android:layout_width="192dp" android:layout_height="192dp" android:layout

Android Notification.Builder vs NotificationCompat.Builder [duplicate]

二次信任 提交于 2019-12-05 21:26:55
This question already has an answer here: Why is NotificationCompat needed? 3 answers Pretty much all the bits of sample code I see for Android notififactions appear to use NotificationCompat. I have written up my own code using Notification.Builder. It is not clear to me what benefits, if any, there might be in using NotificationCompat.Builder. I hope that someone here might be able to explain the differences. You can use things like NotificationCompat.Builder#setLargeIcon(Bitmap) to allow you to take full advantage of Android 3.0+ with things like the large icon, while maintaining

Android Multiple Notifications and with multiple intents

≯℡__Kan透↙ 提交于 2019-12-05 20:26:02
问题 I have a fairly simple app that takes the input from a user and then sets it as a notification. The user can create as many notifications as he/she likes. I want the user to click the notification and get taken to a new activity called ResultActivity . ResultActivity in turn reads in the putExtras from the notifications intent and shows it to the user. The code below allows me to do almost everything I wanted, except anytime a notification is pressed, I receive the putExtra of the last

How to display multiple notification as a group?

夙愿已清 提交于 2019-12-05 19:18:54
问题 here is my code for notification. it generate a new notification each time Random random = new Random(); int m = random.nextInt(9999 - 1000); NotificationCompat.Builder mBuilder =new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.quemark1) .setContentTitle("New Message") .setContentText(message) Intent intent = new Intent(this, ActivityMain.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(ActivityMain.class); stackBuilder

Send argument through PendingIntent of NavDeepLinkBuilder

空扰寡人 提交于 2019-12-05 19:00:18
I'm having some difficulties sending an argument through a PendingIntent of a notification using NavDeepLinkBuilder . I'm able to get the destination Activity to launch by clicking the notification, but the Activity 's Intent doesn't contain the argument value that I passed it through the NavDeepLinkBuilder . The Intent instead returns the defaultValue that I set in the nav graph - "noJobId". Notification creation : val notification = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_id_new_job)) ... .setContentIntent( NavDeepLinkBuilder(context)