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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:21:49+00:00 2026-06-08T07:21:49+00:00

My application can be launched in two ways. 1. Manual launch. (By clicking the

  • 0

My application can be launched in two ways.
1. Manual launch. (By clicking the launcher icon from the launcher menu)
2. Automatic launch(By connecting the USB cable to the device)

The application can be finished in two ways.
1. Manual finish (Pressing the back button)
2. Automatic finish (Disconnecting the USB cable)

I have written a broadcast receiver and it will launch the application if USB cable connects.
Now i am finishing my activity by registering the action "android.intent.action.ACTION_POWER_DISCONNECTED" in the activity itself. It is working fine. My problem is when the user disconnects the usb cable while the device in locked state activity is not getting finished. The broadcast receiver written in the activity is not able receive the action but i can receive the action in the broadcast receiver. I am not able to finish the activity from the broadcast receiver.

What i am doing is made boolean variable true in the broadcast receiver and checks in the onResume() of the activity and trying to finish the activity from onResume(). It is also not working. Is there any solution.

  • 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-08T07:21:51+00:00Added an answer on June 8, 2026 at 7:21 am

    It is fixed now. I was registering the receiver in onResume() and unregistering it in onPause(). So i wont get the action of Disconnecting the usb cable when the device in locked state. Because the application will go to onPause() when the user lock the device. Now i am registering it in the onCreate() and unregistering from onDestroy() so it is working. cheers!!!

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

Sidebar

Related Questions

I have a Clickonce application that is launched from the start menu (local). I
I want to change the app typeface and I can't: AndroidManifest.xml ... <application android:icon=@drawable/ic_launcher
I was removed icon applicaion like this -> http://www.helloandroid.com/tutorials/removing-app-icon-launcher But I can't launch it
i have invoked blackberry calender from my application can anyone tell me how to
all. I'm making app TabBar with two views(ScrollView and TableView). When application launched, TabBar
My application's main icon consists of two parts in one image: a logo and
I have an application that contains two Activities with <intent-filter> <action android:name=android.intent.action.MAIN/> <category android:name=android.intent.category.LAUNCHER/>
I have inherited an application that is launched at login time from my server's
I want make interactive application where user launches it and can do various task
What is the maximum memory one application can use? Please find instrument screenshot with

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.