stemark / toggleheadset2

Automatically exported from code.google.com/p/toggleheadset2
1 stars 0 forks source link

State not proper after phone restart #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use toggleheadset2 to route to earpiece.
2. Restart phone 
3. Audio will be routed to headset when phone restarts.

The root of the problem is my phone, let me make that clear. I have a Droid X. 
And something got screwed up, so now my phone thinks I have headset plugged in 
all the time and routes audio there. Thanks to your app, I've been able to at 
least use my phone.

But when the phone restarts, it would be great to have audio routed to earpiece 
automatically. I have to do it manually now every-time the phone restarts.

I looked into the code and solved the problem by applying the patch attached 
herewith. If you think it's okay for *all* phones to have their audio routed to 
earpiece when they restart, you could apply the patch to your source. I think 
it might help if somebody else has the same problem.

Original issue reported on code.google.com by rabinka...@gmail.com on 23 Feb 2012 at 8:43

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
Thanks for contributing!
It might be dangerous to give this to all users of the current ap as it may not 
be what they would expect.  I think the best way to incorporate this would be 
through a setting that defaults to off but can be configured to force headset 
routing at start through a configuration like AppWidgetConfigure - see 
http://developer.android.com/guide/topics/appwidgets/index.html#Configuring.  
If you have time to work on this great, otherwise I'll leave it on the backlog 
and see how many others might be interested.

Dan

Original comment by danwal...@gmail.com on 24 Feb 2012 at 2:20

GoogleCodeExporter commented 8 years ago
I am trying to learn Android programming. This exercise will probably help me. 
So I added a widget configuration. It's very primitive -- basically presents 
users with a choice to force audio to speaker when phone starts. 
Anyways, I've attached the patch. As I said, I'm just starting to learn this, 
so the code probably isn't of high quality.

Original comment by rabinka...@gmail.com on 24 Feb 2012 at 11:25

Attachments:

GoogleCodeExporter commented 8 years ago
Great... thanks!  I'll try to test and release this in the mid-march timeframe 
if that's OK.  If you want me to mention you as a contributor just let me know 
your name and send a website URL if you want.

Thanks again for contributing.

Dan

Original comment by danwal...@gmail.com on 26 Feb 2012 at 5:47

GoogleCodeExporter commented 8 years ago
Hi-
I tried out your patch tonight, it looks great but I'm missing "toggle_config" 
from the layout subfolder.  Can you attach?

Original comment by danwal...@gmail.com on 12 Mar 2012 at 1:35

GoogleCodeExporter commented 8 years ago
Attached. 

Original comment by rabinka...@gmail.com on 12 Mar 2012 at 2:34

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed with revision 39, just committed a few minutes ago.  Please try it out.  
I needed to modify slightly from the version you sent.  The version you sent 
was preventing audio from ever routing to the headset since it routed to 
speaker automatically when the service restarted.  I modified to only route to 
speaker when BOOT_COMPLETE action is received, which I think still should 
accomplish what you want.  Please give it a try.

Original comment by danwal...@gmail.com on 29 Mar 2012 at 6:17

GoogleCodeExporter commented 8 years ago
That works perfect. Thanks.

Original comment by rabinka...@gmail.com on 30 Mar 2012 at 4:21

GoogleCodeExporter commented 8 years ago
Thanks for testing. I will release with version 2.2, hopefully tonight.

BTW - I ran into some problems implementing BOOT_COMPLETE and decided it came 
down to the order of broadcast receivers defined in the Android manifest.  If 
you are interested I wrote up some info about the fix at 
http://www.ddubtech.com/blog/android-intent-action-boot_completed/

Original comment by danwal...@gmail.com on 30 Mar 2012 at 6:05

GoogleCodeExporter commented 8 years ago
I had actually tried to use BOOT_COMPLETE intent for this and had trouble. With 
my limited knowledge, I didn't know what to look for. So I ended up 
implementing the way I did. Good that you figured out the problem.

Original comment by rabinka...@gmail.com on 30 Mar 2012 at 6:41