Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Android : how to NOT bring the app to front when the user clicks on a button in the notification?

I have got a notification with buttons on it and these buttons modify the notification interface when the user clicks on one of them.

The notification interface updates properly but...the main activity of my app is also brought to front.

How to avoid bringing the app to front?

Thanks !!!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Found the solution !

The intent of the notification has to fire a service and not an activity.

Intent buttonsIntent = new Intent(this, NotificationManagementService.class);
        buttonsIntent.putExtra("do_action", action);
        contentView.setOnClickPendingIntent(R.id.notifButton, PendingIntent.getActivity(this, 0, buttonsIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        notification.contentView = contentView;
  mNotificationManager.notify(1, notification);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!