Category : android-notifications

I am trying to take the title of the notification from the user to show when they reach the highest value and I did this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); minTitle1 = (EditText) findViewById(R.id.minTitle1) ; maxTitle1 = (EditText) findViewById(R.id.maxTitle1) ; submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { highestText ..

Read more

I am using a Custom Notification and finding a way to set its margin/padding based on the phone’s default value. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/notification_custom_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" </LinearLayout> I found some answers here: Android default notification margin I tested on Virtual Devices and some phone models ( Samsung, Oppo, Pixel) , the method ..

Read more

I want to programmatically disable the notification channel for my app. But is there any possible way to disable a notification channel programmatically? How I check if the channel is enabled: public static boolean isChannelEnabled(String channelId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { final NotificationManager notificationManager = App.get().getSystemService(NotificationManager.class); if (notificationManager == null) { return true; } ..

Read more

I’m trying to add 3 buttons to my foreground service notification, but all guides i followed failed this answer says to add action: https://stackoverflow.com/a/49539463/5679560 this tutorial says to use remoteview https://developer.android.com/training/notify-user/custom-notification I’ve tried both options but my notification keeps the default look, even the text doesn’t change at all, my notification refers to the foreground ..

Read more

I’ve always wondered if the application must call createNotificationChannel on every startup or to have they created once on first use is guaranteed to be fine… I ask that because many tutorials like this: https://stackoverflow.com/a/5394210/5679560 suggest to do that during Application onCreate which means every start of the app But, unless there is a way ..

Read more

I’m using Jetpack Navigation in my project following image describes my navigation. In my Application Home Fragment is my NavHostFragment and I’m using foreground service in Fragment A. When I navigate from Home Fragment to Fragment A and close the application or minimize then foreground service run with notification. When I pressed notification Home fragment ..

Read more

I want to show icon of my app’s notification in the left-most position no matter if new notification arrive or not. what can I do to achieve this? also, my notification is showing at 3rd position in the notification bar(when there’s already other notifications present). I want my notification to always show on top and ..

Read more