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

  • Home
  • SEARCH
  • 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 3307806
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:26:55+00:00 2026-05-17T21:26:55+00:00

I am currently have two seperate applications, both perform seperate tasks, but there is

  • 0

I am currently have two seperate applications, both perform seperate tasks, but there is on limited occasion times when I need one application to use the other if its there.

So I use a function to check the required application exists:

public static boolean isIntentAvailable(Context context, String action) 
{
    final PackageManager packageManager = context.getPackageManager();
    final Intent intent = new Intent(action);
    List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
} 

If it does, then I use the following to start the activity with an extra on there:

if (isIntentAvailable(ListPOI.this, "com.me.myapp.MY_MAP"))
{
    Intent i = new Intent("com.me.myapp.MY_MAP");
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.putExtra("place", true);
    startActivity(i);
}

The setFlags means if the user presses home, and they go back to the first app, it opens, it doesn’t open the second app called here.

This all works fine, the first time. However after calling the this the second time, the second app resumes, so it doesn’t pick up the ‘extra’ which has been passed, how can I ensure I get the extra?

  • 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-17T21:26:56+00:00Added an answer on May 17, 2026 at 9:26 pm

    The final answer to my question has been using the following:

    I created a function to handle loading intent extras:

    private void handleIntent(Intent intent)
    {
        Bundle extras = intent.getExtras();
        if (extras != null)
        {
            place = extras.getString("place");
        }
    }
    

    In onCreate I use:

    handleIntent(getIntent());
    

    Then added the following function to get the intent when an existing instance of an activity is passed a new intent:

    public void onNewIntent(Intent intent)
    {
        setIntent(intent);
        handleIntent(intent);
    }
    

    I also added android:launchMode="singleInstance" to the activity declaration in the manifest of the activity with the above code.

    Finally from the first package, I can now use the following code to start the second package with an extra. When the second package starts, the user can click on the first package (from the home launcher) and get the app they expect, and if they click to start the second package, the ‘already running’ instance is shown, but captures the new extra which has been passed:

    Intent i = new Intent("com.me.myapp.MY_MAP");
    i.putExtra("place", place);
    startActivity(i);
    

    Hopefully this will be helpfull to someone – its probably not the best way to do this, but it works for me.

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

Sidebar

Related Questions

I currently have a single solution that contains both the one application developed so
I have two distinct databases as a source for a Silverlight RIA application. They
Status Quo For our customer we are developing some libraries and applications that run
The ASP.NET web application I am developing needs to support two different types of
I have an EXE class which contains a button resource with ID EXE_BUTTON_RESOURCE ON_UPDATE_COMMAND_UI(EXE_BUTTON_RESOURCE,
I'm trying to find the best way logically separate projects in TFS 2010. Currently
I have a Java main application with somewhat complex command line arguments. These arguments
Here's what I have. I have an MVC application where all the data is
I'm writing a dll library in Delphi with multiple threads created by it. Let
I would like to get opinion on the best way to manage the following

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.