Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove notification from status bar? #250

Open
himanshu-my opened this issue Dec 2, 2021 · 8 comments · May be fixed by #444
Open

How to remove notification from status bar? #250

himanshu-my opened this issue Dec 2, 2021 · 8 comments · May be fixed by #444

Comments

@himanshu-my
Copy link

I have attached a notification when starting the service like below

mqttClient!!.setForegroundService(notification.build(), notificationId)

Now my issue is when I disconnect and close the mqtt connection still notification not removed from the status bar. Please suggest how can I remove that notification after mqtt disconnection.

@hannesa2
Copy link
Owner

hannesa2 commented Dec 2, 2021

When you do this

mqttClient!!.setForegroundService(notification.build(), notificationId)

you can remove it with this

val notificationManager = NotificationManagerCompat.from(context)
notificationManager.cancel(notificationId)

@hannesa2 hannesa2 closed this as completed Dec 2, 2021
@himanshu-my
Copy link
Author

I have used

val notificationManager = NotificationManagerCompat.from(context)
notificationManager.cancel(notificationId)

and

val notificationManager =
MyApp.appContext.
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.cancel(notificationId)

    this as well, but still notification is not removing. 

@Monika-Paliwal
Copy link

Please Reopen this issue , this issue is still occurring and also provide the exact solution for it

@hannesa2 hannesa2 reopened this Dec 10, 2021
@hannesa2
Copy link
Owner

and also provide the exact solution for it

This repo comes with a contribution model. I'm not the only one who can contribute

@stale
Copy link

stale bot commented Jan 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

@hannesa2
Copy link
Owner

Sorry for the late response.
Please use https://github.com/hannesa2/paho.mqtt.android/releases/tag/3.6.0-beta7 and please tell me, how it works after several connect/disconnect. I didn't tested this.

@Elswah
Copy link

Elswah commented Jan 11, 2024

i tested it not working properly and application crash

@hannesa2
Copy link
Owner

i tested it not working properly and application crash

Please show me the crash. I guess a crash would be found by CI, but maybe I'm wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants