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 6103291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:42:44+00:00 2026-05-23T13:42:44+00:00

I am implementing an activity that responds to the RecognizerIntent . Among others this

  • 0

I am implementing an activity that responds to the RecognizerIntent. Among others this activity must handle two incoming extras that specify a pending intent and its extras-bundle:

  • EXTRA_RESULTS_PENDINGINTENT
  • EXTRA_RESULTS_PENDINGINTENT_BUNDLE

Paraphrasing the documentation:

  • If you use EXTRA_RESULTS_PENDINGINTENT to supply a PendingIntent, the results will be added to its bundle and the PendingIntent will be sent to its target.

  • If you use EXTRA_RESULTS_PENDINGINTENT to supply a forwarding intent, you can also use EXTRA_RESULTS_PENDINGINTENT_BUNDLE to supply additional extras for the final intent. The search results will be added to this bundle, and the combined bundle will be sent to the target.

I have been looking in vain for sample code that would demonstrate the following.

What is the best way of extracting a PendingIntent from a bundle?

Should I do:

(PendingIntent)
        extras.getParcelable(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT)

How to add extras to the set of existing extras of a PendingIntent?

How to launch the modified PendingIntent?

  • 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-05-23T13:42:44+00:00Added an answer on May 23, 2026 at 1:42 pm

    These are my current answers to these questions. It works like this in a number of Google apps (Maps, Docs, YouTube, Listen) which all pass the PendingIntent to the RecognizerIntent when you perform the search via the microphone button. I am unsure though if this is the best (or most general) way of doing it. Any comments are welcome.

    What is the best way of extracting a PendingIntent from a bundle?

    Parcelable extraResultsPendingIntentAsParceable =
               bundle.getParcelable(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT);
    if (extraResultsPendingIntentAsParceable != null) {
        if (extraResultsPendingIntentAsParceable instanceof PendingIntent) {
            mExtraResultsPendingIntent =
                             (PendingIntent) extraResultsPendingIntentAsParceable;
        } else {
            // Report an error
        }
    }
    
    mExtraResultsPendingIntentBundle =
              bundle.getBundle(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE);
    

    How to add extras to the set of existing extras of a PendingIntent?

    Here we just create a new intent and put all the required extras into it.

    if (mExtraResultsPendingIntentBundle == null) {
        mExtraResultsPendingIntentBundle = new Bundle();
    }               
    Intent intent = new Intent(); 
    intent.putExtras(mExtraResultsPendingIntentBundle);
    // Unsure about the following line...
    // Should I use another name for the extra data (instead of SearchManager.QUERY)
    intent.putExtra(SearchManager.QUERY, speechRecognitionResult);
    

    How to launch the modified PendingIntent?

    We send off the PendingIntent giving it the new intent (with the new extras) as an argument.

    try {           
        mExtraResultsPendingIntent.send(this, 1234, intent);
    } catch (CanceledException e) {
        // Handle exception
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

implementing publishActivity in PHP using the REST API using this code: $activity = array(
I am implementing an activity indicator in my application. In my application on button
I am implementing a code that based upon a particular response from a web
I am implementing a MyGestureDetector that extends a SimpleOnGestureListener. I borrowed the class from:
I am implementing a simple alert view with activity indicator to show to the
I'm implementing a series of UI screens that collect information for a new 'thing'
I was implementing a ListView activity with custom drawn views and had the following
I have an application that contains a main Activity, which has a very simple
I am implementing android application which is on web service. I'm creating login Activity
I am implementing an app that uses the native language settings which can be

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.