Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:05:02+00:00 2026-06-06T07:05:02+00:00

I am working on an android app, and I am currently trying to create

  • 0

I am working on an android app, and I am currently trying to create a notification, and once the user clicks on the notification, an activity should be launched. The notification is being created fine but the activity is not being started.

Below is the code for the notification.

private void showNotification(String username, String password)
{
    String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager notificationManager = (NotificationManager)context.getSystemService(ns);

    CharSequence tickerText = "Username Copied";
    long when = System.currentTimeMillis();

    int icon = R.drawable.icon;

    Notification notification = new Notification(icon, tickerText, when);
    CharSequence contentTitle = "BPM - Login Management";
    CharSequence contentText = "Username Copied";

    Intent intentNotification = new Intent(context, CopyPassword.class);
    intentNotification.setAction(Long.toString(when));
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    intentNotification.putExtra("password", password);

    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intentNotification, PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

    final int NOTIFICATION_ID = 1;
    notificationManager.notify(NOTIFICATION_ID, notification);
}

The notificiation is being generated from within a normal java class not an android activity in case this makes any difference.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:05:03+00:00Added an answer on June 6, 2026 at 7:05 am

    Remove the setAction this isn’t needed.

    Try:

    Intent intentNotification = new Intent(context, CopyPassword.class);
    intentNotification.putExtra("password", password);
    
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intentNotification, 0);
    
    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
    

    Also ensure the CopyPassword Activity is declared in your AndroidManifest

    I wrote a blog post about it: http://blog.blundell-apps.com/notification-for-a-user-chosen-time/ 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on an Android app and I am trying to get
I am currently working on an Android app and I am trying to connect
Currently, I'm working on an Android app for Pinterest. What I am trying to
I am currently working on an Android app and I am having some issues
I'm currently working on an Android app. I would like to use the app
I'm currently working on converting an Android app I built natively as an iPhone
I'm new to android game development. I currently working on a simple android app
I am currently working on building an Android app for my Rails backend. I
Hey guys i am currently working on an android app that will allow me
I am currently working on an android project. I am trying to have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.