Android :: How To Detect Power Connected State
Jul 16, 2010Is there an easy way to be notified when USB or AC power is connected to an Android phone?
View 1 RepliesIs there an easy way to be notified when USB or AC power is connected to an Android phone?
View 1 RepliesI'm currently working on a project which requires the detection of user state (walking, running, driving), I've looked through some of the existing solutions on Android platform such as pedometer or calculating velocity with given acceleration, but I'm still unsure how I can approach this problem. Is there a way to accomplish this without much of data mining/signal processing? How can I solve this with simple logic? Or is this better solved with gps instead of accelerometer? The program will only need to return simple user-state descriptions like walking.
View 1 Replies View RelatedI wanna write an app to enable and disable the Bluetooth device synchronized. Referring the Android source code, I registered following receiver to receive the bluetooth state change event:
CODE:............
But it doesn't work. Although the BT status has been changed (the icon of BT has been appeared or disappeared), the receiver could not receive nothing.
i have a service (that extends Service). public class MyService extends Service ..
View 2 Replies View RelatedI tried in many ways to check Internet connection in my android emulator
CODE:.........
Even if i disable Internet connection in my system ,my code seems to display Connected state
so i guessed this may work
CODE:.......
But the above code also displays "Connection Present" even when i disconnect Internet cables. Please help to find a correct way to do this .I have ACCESS_NETWORK_STATE and INTERNET permission in my manifest file
I didn't find an API to detect if a Bluetooth A2DP is connected. Can somebody point me out how to check? It looks like if I route audio to Bluetooth A2DP without check, the sound will be routed anyway, and the speaker is turned off.
View 2 Replies View RelatedMy application acquires and releases WakeLocks. What is the best way to test the app - i.e. is there a standard way to determine when the cpu is running (e.g. through a debug cable)?
View 2 Replies View RelatedI have made an Android based arcade machine that I want to sell to operators. They are accustomed to having an arcade machine boot up from one switch, and they also like to be able to leave that switch on so they can just turn on and off all machines with a surge protector switch or light switch. It doesn't seem possible to just have a simple binary ON/OFF switch for the K-R42, so I have to do it by having everything hooked up to a surge protector. Problem is that if I turn off the Android box by turning off the surge protector, I can't turn it back on that way. I'd like to find a way to have the Android device power on automatically from the off state when electricity is restored (sort of like the turn on after power failure option in Windows BIOS). I had read that this may be doable in the BOOTLOADER, is that true?
View 1 Replies View RelatedCan android OS start/ run/ boot automatically when the charger is connected? Can the android boot up instead of showing the battery charging screen?
View 6 Replies View RelatedAny way to have a device automatically turn on when it is connected to AC from a power off state? My asus transformer already does this, but I'm not sure if there is a hardware requirement for this or if a system file can edited to enable it. I have another tablet (elocity A7+) that I want this feature for a car install.
View 3 Replies View RelatedI have a Rikomagic MK802IV which uses HDMI as its primary output.
I'm looking for a way to detect that the screen attached to the HDMI out has been turned off, or is in sleep mode, either through a command-line tool or a Java app. So far, I've figured out how to detect whether there is something connected by checking the contents of this node in sysfs: /sys/class/display/display0.HDMI/connect
However, this only reports whether something is connected, not whether it's on or off.
I also tried using the isScreenOn() method in Android's PowerManager API to check the power on state, but it always returns true, regardless of whether the screen is on or off.
Does getting the external HDMI's power state is possible on Android?
I can use this code make outgoing call.
Intent dial = new Intent(Intent.ACTION_CALL); dial.setData(Uri.parse("tel:5556") );
context.startActivity(dial);
But how to detect call pick up the call or refuses to answer?
I tried PhoneStateListener but not working.
Odin only detect my Samsung Galaxy Pocket S5300 when the power is off.
In a meanwhile:
- Odin cannot detect in Download mode.
- KIES is able to connect, detect & do the backup.
- I've tried many versions of Odins.
- Odin(s) is able to detect other phone (Galaxy Mini S5570).
- PC could detect the driver and do the file transfer.
Why only when the power off id:com turns into yellow (or green in Odin 3) ????
I have a compound UI component built up from a ViewGroup containing a number of TextView, ImageView etc. components. Many of these have StateListDrawables as their images/backgrounds. Is there any way of making them select from this drawable based on the state of the parent ViewGroup rather than the component itself? Ideally I want to be able to change the visual state of all children of the ViewGroup (text colour, image etc) based on the state of the ViewGroup, preferably without having to hook up complex logical code. This seems like a fairly common sort of requirement, so I was hoping it would be straightforward in Android - am I going to be disappointed?
View 1 Replies View RelatedI'm a little confused by what I'm seeing with regards to phone state transitions via the PhoneStateListener. When I receive a call, this is what happens: (call comes in) RINGING -> IDLE (I pick up) OFFHOOK (I hang up) IDLE It's that first transition from RINGING to IDLE without any interaction from me (not ending the call, not answering the call) that confuses me. Do I really have to implement an idle counter to know that an incoming call has really ended? Seems like the reported phone state represents some sort of phone state that isn't the obvious one.Is this a bug or am I just not in tune with the paradigm here?
View 2 Replies View RelatedDownloaded FoxFi, and love it. Great when I need to use my laptop. But...
Lately, I've noticed it has been having connection issues. I start the hotspot, my laptop "sees" it. And I can connect (shows "connected" in the wifi window next to "FoxFi" on laptop). But, at the top of the same wifi window, it also shows (under "Currently connected to:"), "No internet access" (or something - connected right now on different wifi network, so I can't get the exact wording). But I hope this is clear.
Why this weird contradiction? One part of the window says I'm connected, the other says I'm not.
I posted this earlier but it disappeared? When the phone is unplugged, it says USB connected, and all of the icons are missing from the top of the homepage (time, signal strength, 3g, etc). The pull down menu is also hard to pull down then is real jerky when it does pull down. When the phone is plugged in, it has the signal for the USB and all the icons return, It also shows a full battery, then tho it is not.
View 3 Replies View RelatedHas anyone had any luck with aftermarket power supply's. I'd like a car/ac charger or a stand alone power pack. I usually use my DEXIM. but it does not work with the Behold 2. I've tried a car charger/battery unit by Wireless Gear that said it was compatible with all Samsung phones, it came with 5 power tips and a USB outlet that still would not work, even using the OEM USB cable. Any suggestions would be appreciated. I will go with OEM Samsung if necessary, but there selection is limited.
View 4 Replies View RelatedI have a rooted Galaxy S3 with Android 4.1.2, and for some strange reason they've changed the screenshot combination away from the Power+VolDown that other Androids use to Power+Home which can't realistically be pressed one-handed. How can I change it back to Power+VolDown?
View 6 Replies View Relatedmy phone is karbon A9+ and i wiped the cash,system and data and after that flashed a Custom ROM ! but now the phone just power on in download mode!! how to power on, for recovery or normal power on ! the phone just have the black screen with "Entry QPTS Downloading" Text..i will back to India 5 month later ! can it be fixed or i have to wait for 5 month to come back and send it to service !
View 1 Replies View RelatedI have installed Power Strip, and the very first time I was asked to use my preferred home screen, I selected the existing one (using a GS).
What I want to do is to have Power String dock displayed if I do a double click on the home key. I played with the settings but it seems that it doesn't work. Any hint?
Is it possible to know when the user unplugs a charger or headsets from the device so I can trigger something..
View 2 Replies View RelatedI'm trying to get current service state of my phone. It can be easily fetched with get State() method of Service State when a on Service State Changed (Service State service State) callback is invoked: Code...
View 2 Replies View Relatedcan someone helpme out with how to save state of the app when the screen orientation is changed i read the development guide at http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange
But i dont know how to define the method collectMyLoadedData();
I have an app that runs in the background indefinitely provided there is work to be done. I want the app to go to sleep if there is no work to be done and the user is idle. The second part has me stumped. On Windows Mobile I was able to poll the power state to determine user idleness. On BlackBerry I was able to poll the device idle time. However, there does not appear to be a way to determine user idleness on Android.
Instead of polling for user idleness directly, I thought I might be able to use the on/off state of the screen. There are 2 intents ACTION_SCREEN_OFF and ACTION_SCREEN_ON and I was able to setup a listener for these (BroadcastReceiver). The problem is that I do not know how to determine the current state of the screen at the time I register the listener, therefore I have to wait until the next screen on/off change to know anything. The docs speak of some intents that are "sticky" and thus will allow the current state to be determined, but the screen events do not appear to have that property. What am I to do?
In general, I find the lack of support for polling system state properties (e.g. screen state, power state, signal strength) in Android to be annoying. It's cool that one can listen for changes in system state rather than constantly polling for them, but one still needs to know the current state of the property at the time the listener is registered.
I need to save some state when the user leaves my game during game play. Saving the state doesn't seem to be an issue, but I can't figure out how to restore it. The onCreate function isn't called when the Activity is resumed (only when it is first created), so I can't get my state back there. Logically, I would use onRestoreInstanceState, but it isn't being called.
CODE:..........
I see log output from onSaveInstanceState, onResume, onCreate, etc, but I never see a log message from onRestoreInstanceState and savedState is always null. Why isn't onRestoreInstanceState being called, and is there another way to get my state back?
My business partner and I have a small disagreement, and I'm trying to figure out the best way to resolve it. First, I should say I started out his way, and switched after reviewing a lot of applications. The background is this -- we have an app, with some controls which can be locked. A lock/unlock icon is put next to the lockable controls. You can long-click the icon, and it brings up a context menu with several items, including the item for the lock state.Currently, it brings up a "Locked [X]" or "Locked [ ]" item -- that is, a menu item with a checkbox that can be checked or unchecked, and the lock state is changed accordingly.He would like me to change it to reflect the action being taken. I.e. the menu item would say "Lock" if it is currently unlocked, and "Unlock" if it is currently locked.It would be acting as a toggle in either case; the only difference is how it is presented to the user.
View 7 Replies View RelatedAt the moment I am trying to update my application to Android 1.5. In Android 1.1 I was able to detect the BT state with catching the following broadcasts: Code...
View 8 Replies View RelatedI am writing an app where I get all the data from the rest call and display all the data in a custom component list(based on Linear Layout) which is added to a LinearLayout. I write this code in onCreate of the activity. The problem is when I switch activity using startActivity, and come back to the calling activity (using startActivity) then onCreate is called again. I see onPause, onStop called when I call other activity. Is there any way that I can save the application's state?
View 1 Replies View RelatedThere is know problem in all the Android phones. Go to Bluetooth Settings->Turn ON bluetooth->Click on bluetooth discovery->Then timer will start in summary->Long press on Bluetooth device discovery-> observe Bluetooth ON/OFF title start to toggle with Bluetooth Discovery toggle. I analyzed the issue. Blueooth ON/OFF is CheckBoxPreference. Bluetooth Discovery is also CheckBoxPreference which has dependency on Bluetooth ON/OFF. When we click on Bluetooth discovery then On thread will run at every second to update summary in Bluetooth Discovery preference. When we change the Bluetooth discovery to OFF then thread will be removed/ killed. When i press the Bluetooth discovery for long time when its already in ON State then still the thread will be updating the summary (remaining time from 120 to 00) till i press it. When i leave the Thread will stop. As it has dependency on Bluetooth ON/OFF, its making to the title invisible. But it should not happen. Solution: When i touch the Device Discovery i should kill the update summary thread then i guess, that problem will be solved. But in prefence i dont have any listener to know the pressed state. I hope somebody can give me solution.
View 2 Replies View Related