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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:17:37+00:00 2026-06-06T17:17:37+00:00

In our Android application I implemented the contact selection by using Intent action *ACTION_PICK*

  • 0

In our Android application I implemented the contact selection by using Intent action *ACTION_PICK* on the *ContactsContract.Contacts.CONTENT_URI*. This method works fine (mostly), but unfortunately I have no control over the incoming events activity.

The app have to log out and quit when it is enforced into the background. At the moment it is implemented by making use of the activity event: onStop() for the main activity, but obviously the app won’t receive that event if the contacts activity from the system is open.

I have tried to subclass the contact activity somehow, but I am afraid it cannot be managed.

I tried to use different activity start flags, but couldn’t find any relevant flag for this situation (not to mention that flags are not working with startActivityForResult() method).

I tried to hook into different broadcasted events, but there are way too many possibilities that ends up pushing the app to the background.

I have found some tricks for polling the application on the top, but that would require GET_TASKS permission and generally it would be a major hack anyway. I would rather not go there.

So, to sum up my question:

Is there any way to detect that the application is enforced into the background while the contact activity is open?

  • 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-06T17:17:39+00:00Added an answer on June 6, 2026 at 5:17 pm

    Finally, my colleague found the answer:

    Add the following properties to the main activity:

    android:launchMode="singleTask"
    android:clearTaskOnLaunch="true"
    

    And after the user pressed the home button while the contact selection was open and relaunched the app a new event will be triggered on the main activity:

    public void onNewIntent(Intent newIntent)
    

    The cancel result code is still coming back similarly like when the user pressed the back button on the contact selection activity, but in that case this specific event won’t be triggered.
    This way I can differentiate between the situations when the user closed down the contact activity and when the system closed it down.

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

Sidebar

Related Questions

How to access Facebook friends list in to our android application using Facebook API
Our android application is getting fairly big and we would like to use functional
To create facebook android native app we need to provide our Android application signature
Im using an ant build file that has been generated by android. Our Android
Based on the user requirements, he wants to use our android application via pin
We need to enable our customers to update some components in Android application, like
We are planning to create an android application for our web application. I have
I'm having some errors with my custom recording application using android. I saw most
I'm working on an Android application. Our problems manifest when the user runs our
How to Change the default Application image in android??we want to distinguish our application

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.