Android :: HEADSET PLUG Not Registering As Receiver
Oct 6, 2009
I'm trying to create application fixing problem with audio volume in headset/handset(I cannot find such application in the market).There is ACTION_HEADSET_PLUG intent,but I cannot register it in manifest. Registering it using registerReceiver does not make sense becouse app should be run always when headset is plugged/unplugged, app will also have no GUI/Activity.
View 4 Replies
Feb 15, 2009
yesterday, I spent several hours trying to figure out how to capture the HEADSET_PLUG intent with a BroadcastReceiver. The manifest defines the <receiver>, with its intent-filter set to <action android:name="android.intent.action.HEADSET_PLUG" />.
The receiver is working correctly (I verified that by changing the intent filter to capture things like SMS_RECEIVED including the proper permissions and the receiver fired as expected on receiving an SMS), but when listening for HEADSET_PLUG, it never fires. Debugging the whole thing is a bit complicated, as the emulator doesn't seem to support headsets and I have to disconnect my target device (a HTC Dream) from USB in order to attach a headset (so there's no logfile viewing). Are there any special permissions required for applications to capture the HEADSET_PLUG intent (and if so, which? I've tried several, to no avail)?
Maybe the Dream doesn't fire such an intent at all (that'd be bad luck for me), but I guess that it must be an issue related to application permissions. The documentation says extremely little (well, actually: nothing) about the single permissions needed to perform all the actions described in the API docs, so this is absolutely something to be improved.
What I want to do: Upon detecting a headset, I want to re-route the ringtones from the speakers to the headset, so as not to annoy people in my vicinity by a harsh ringing sound (I'm used to this behaviour from my old phone) - by default, the speaker just keeps on ringing, no matter whether a headset is attached or not. This part is already working, but now I need to know how to detect headset attachment/ detachment events.
View 7 Replies
View Related
Aug 13, 2010
I want to run some code when an app is launched, so my broadcast receiver has to be notified when user open any app.
View 1 Replies
View Related
Feb 23, 2010
I was wondering is it possible to register a broadcast receiver to receive two intents? My code is as follows:
sipRegistrationListener = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(SIPEngine.SIP_REGISTERED_INTENT.equals(action)){
Log.d("SETTINGS ", "Got REGISTERED action");
} if(SIPEngine.SIP_UNREGISTERED_INTENT.equals(action)){
Log.d("SETTINGS ", "Got UNREGISTERED action");
} } };
context.registerReceiver(sipRegistrationListener, new IntentFilter(SIPEngine.SIP_REGISTERED_INTENT));
context.registerReceiver(sipRegistrationListener, new IntentFilter(SIPEngine.SIP_UNREGISTERED_INTENT));
I get the registered Intent everytime I send it but I never get the unregistered Intent when I send it. Should I set up another Broadcast receiver for the unregistered Intent?
View 1 Replies
View Related
Sep 28, 2009
trying to create a broadcast receiver which responds to system events and change system settings. I don't need any interaction from the user so I don't need an activity and have been trying to do everything through the manifest file. I've put a log event into my onReceive method but it never logs anything so I'm presuming my method is never called. I've tried this with both the 1.5 and 1.6 SDKs. I was hoping somebody could have a look at my code please and let me know if there are any problems.
View 2 Replies
View Related
Jun 19, 2010
Went for a jog this morning and had earphones plugged in, when I finished jogging I removed the earphones and the phone still says they are plugged in. No rain or moisture involved. I have pulled the battery and restarted with no improvement. Any ideas or suggestions?
View 2 Replies
View Related
Apr 23, 2010
I'm a student developer. I have developed few apps for Android, I wanted to publish them in the Android Market, but I don't have access to Credit Card for sign up process as Banks won't issue credit cards for students (people with no income). Is there any alternative for this?
View 4 Replies
View Related
Sep 5, 2010
I'm trying to test the C2DM framework. I got the confirmation email a couple of days ago and then tryied to create a client that could register. For that purpose, I created a simple client following the steps described in this tutorial:
http://code.google.com/intl/es-419/android/c2dm/index.html.
The Android manifest file contains among other things this code:
<permission android:name="com.bilthon.ufrj.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.bilthon.ufrj.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET"/>
<receiver android:name=".C2DMReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.bilthon.ufrj" /> </intent-filter>
<intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.bilthon.ufrj" /> </intent-filter> </receiver>
And then, the main activity launched when the program starts has the following code:
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
// boilerplate registrationIntent.putExtra("sender","mytestemail@gmail.com");
Log.d("WelcomeScreen","mytestemail@gmail.com");
startService(registrationIntent);
I also registered a google account on the AVD running my client, as they said it was required. But the problem is that I cannot get the broadcast receiver to "wake up". I don't know what could be wrong. By analysing the logs, I can see that the registration intent is created and apparently used correctly, but the receiver code just never is executed, what could be wrong?
View 3 Replies
View Related
Aug 2, 2010
i may get flamed for this question, but help me do it right. I was downloading images from a website and putting them into a database, and then displaying them in an imageview. well to reduce the size of my database, i changed from an imageview to a webview and now only do a Webview.Loaddata(ImageLink). all of this is contained within a listactivity.my problem seems to be that for whatever reason now i dont seem to be capturing the Listclick event any longer
View 2 Replies
View Related
Apr 4, 2010
The better keyboard application is better than the stock keyboard in almost every way. But there is one big problem with it that I've found, and that's that it has trouble registering two nearby keys tapped in rapid succession, often registering neither of them. If I try and type "that" with two fingers, I'll often just get "th"-- it interprets left thumb pressing "a" and right thumb pressing "t" as... nothing, I guess.
View 16 Replies
View Related
Dec 16, 2009
How can I register a sync-service programmatically? For example:
<service android:exported="true" android:name="com.example.test.SyncService">
<intent-filter> <action android:name="android.content.SyncAdapter" />
</intent-filter> <meta-data android:name="android.content.SyncAdapter" android:resource="@xml/syncadapter" /> </service>
How would I register this service at run-time?
View 4 Replies
View Related
Aug 4, 2010
How can I open a context menu for a view without registering it using registerForContextMenu()?
My activity overrides onTouchEvent to detect motion, and if I use registerForContextMenu() it stops working. I'm detecting a long press, so I'd like to forward that request to a method that would build the menu for me, but don't know if it can work that way.
View 2 Replies
View Related
Sep 6, 2010
I am trying to understand the main differences between registering a BroadcastReceiver in the Manifest and registering it programmatically...
My understanding is basically as follows - would appreciate someone correcting my points if I am missing something.
Registered in Manifest:
- The OS will magically find and instantiate your class if needed, calling the onReceive() method, regardless what the running state of your application was
- Your receive will only get called once per broadcast (i.e. You can consider that registering in the manifest is like registering your 'class' for receiving the broadcast - and the broadcast instantiates your class as needed) (??)
Registered Programmatically:
- registering in code means that you are registering instances of your class to receive broadcast messages (i.e. if your code is a little sloppy, and you manage to register several times, you will end up with multiple BroadcastReceiver instances all having their onReceive() called for a broadcast
- to deregister, you need to deregister the specific BroadcastReceiver instance that you previously registered
- if your application gets destroyed by the OS, your onReceive() method will not be called for a broadcast
View 1 Replies
View Related
Jul 30, 2010
its not that big deal but i found a Syntax error in the code for C2DM Registering from this site registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0); where they missing the end ")" and here's my magical fix :) registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
View 2 Replies
View Related
May 6, 2010
Essentially my problem is this, I open my Activity. It binds to a local service that "appears" to be connected. I get a force close when I press the back button:
"IllegalArgumentException: Service not registered" when unbind is called in my onPause method...
public void onPause() { super.onPause(); if (isFinishing()) {
if (mConnection != null){ Log.i(TAG,"onPause, mConnection" + mConnection.toString());
mDbS.unbindService(mConnection); }else { Log.i(TAG,"mConnection is null");
} The service is bound in onCreate // bind to our sdCard database using our Service Connection
mServiceIntent = new Intent(this,DatabaseService.class);
if(bindService(mServiceIntent, mConnection, Context.BIND_AUTO_CREATE)){
Log.e(TAG, "service bound"); }else{ Log.e(TAG, "service not bound");
} bindService is returning true.
My Service connection is as follows. onServiceConnected is called and goes to completion. onService Disconnected is never called (presumably because my service is in same process)
private ServiceConnection mConnection = new ServiceConnection() {
public final String TAG = "LoadView.ServiceConnection"; //$NON- NLS-1$
public void onServiceConnected(ComponentName className, IBinder service) {
mDbS = ((LocalBinder<DatabaseService>) service).getService(); .....
stuff not relevant.... Log.i(TAG, "finished onServiceConnected");
//$NON-NLS-1$ } public void onServiceDisconnected(ComponentName className) {
Log.e(TAG, "onServiceDisconnectedCalled"); //$NON-NLS-1$ } };
The only thing I do a little different is that I don't use an inner class in my service for the Binder object - I use a separate class. This is mostly because I have several databases and wanted code I could reuse and set up simply rather than worry about all the ins and outs and memory leak issues.
import android.os.Binder; import android.util.Log;
public class LocalBinder<S> extends Binder { private String TAG = "LocalBinder";
private S mService; @SuppressWarnings("unused") private LocalBinder() {
} public LocalBinder(S service){ mService = service;
} public S getService() { return mService;
} public void finalize(){ mService = null;
try { //TODO reinstate this after Issue 8046 is resolved
//super.finalize(); } catch (Throwable e) { Log.e(TAG,"Unable to finalize Binder");
} } }
View 2 Replies
View Related
Sep 10, 2010
I am a new SE user and am still getting to grips with using the phone's features. Could anyone advise how to transfer a call from a headset back to the phone and phone to headset? Whilst I am asking inane questions, is it possible to use the phone i.e. return to menu when in a call?
View 2 Replies
View Related
Jan 12, 2010
I'm trying to do something in my app where you have to hold your finger on the screen for more than 30 seconds. After about 30 seconds, it stops sending onTouchEvents for that part of the screen, almost like a "dead zone." Tested on a motorola droid, and is there any way to stop this from happening?
View 6 Replies
View Related
Oct 19, 2010
I am trying to register to several proximity alerts. Here's an excerpt:................
View 3 Replies
View Related
May 11, 2010
made a custom list adapter extending the Base adapter. Each item in the list has an imagebutton, 2 textviews and a button. I tried to add the context menu to the list so as to display some options for an item in the list. registerForContextMenu(getListView()); I used a MenuInflater object to inflate the context menu xml file. But on clicking the items in the list nothing shows up or the usual highlighting of the item of list on click isn't shown. Is it that the context menu doesn't work for custom list views? Any help would be much appreciated.
View 1 Replies
View Related
May 15, 2010
I'm creating my first widget and ran into a snag. I have several buttons on this widget and need a way to register an onClick action for each of the buttons. So far I've only found examples where they start a configuration activity from a widget button. Does someone have example code on using buttons in home screen widgets?
View 4 Replies
View Related
Nov 8, 2010
I want to flash my phone back to android 2.1. My phone is in download mode but odin is not picking it up?
View 3 Replies
View Related
Oct 11, 2010
having weird issue with my ladies phone , the mic isnt picking up any sounds, she says she didnt drop it or anything , im just wondering what it could be
View 9 Replies
View Related
Mar 29, 2010
I downloaded swype, (nexus friendly version from XDA). Ive installed it, and when I open a text field, I can use it.
I can tap the letters to type, but when I swype my finger, the whole keyboard becomes highlighted around the edges. Its not registering the swype, but I registers taps.
View 2 Replies
View Related
Jun 24, 2010
On my Nexus the onboard microphone is not registering any sound at all. I have to use a bluetooth headset to be able to talk. The phone is completely stock, any ideas on how to bring it back to life?
View 4 Replies
View Related
May 31, 2010
My son's SIM card is not registering on his Hero. It had been working fine until last night. It works fine in my wife's phone. Both are on Orange in UK.
View 3 Replies
View Related
Sep 15, 2010
I've got the Windows 7 64bit professional and when I plug it into the usb it says "installing device software..." and than "Device not recognized..." I want to put photos and music on my epic!
View 13 Replies
View Related
Sep 1, 2010
I can't figure this out. First thing I did was open allshare. I selected "play media from phone on another device." It couldn't find any devices. I then checked out my PS3. I tried going to the remote play settings to register my device. It gives me a number to input during device registration but this is where I get stuck. I don't know where to go from here. Allshare doesn't have an option to "register a device." How to do this: DLNA works with a PS3.
View 4 Replies
View Related
Jul 23, 2010
I got my Droid X on launch day from Best Buy, and like most people here, I am very happy with my phone. However, I've been having a problem and I don't know if anyone else has been having it. Sometimes when I'm typing on Swype, or just using the phone in general, my finger won't register on the screen. For example if I'm typing a word, the line in Swype will get disconnected, and thus I will not have the right word. Also on my homescreen, when this happens I would not be able to switch between homescreens. If I lock my phone and unlock it again, usually this seems to fix the problem. I'd say at least once every 10 times I use my phone.
View 8 Replies
View Related
Jun 16, 2012
My phone seems to register double touch input while i am only using one finger. It only happens only when i pass the my finger over the middle of the screen, ie. a horizontal line in the middle of the screen. This is affecting scrolling and tapping on anything in the middle of the screen.
I just want to know if this a software (calibration) issue or a problem with the screen itself.
See attached a screenshot of multi-touch test using 'Display Tester'.
View 2 Replies
View Related
Jul 30, 2010
What are you guys entering for Model Code? I'm seeing the below choices but can't find anywhere which one my phone is:
1. SGH-T959ZKATMB
2. SGH-T959ZKBTMB
3. SGH-T959ZKDTMB
4. SGH-T959ZKMTMB
View 32 Replies
View Related