Closed GoogleCodeExporter closed 9 years ago
I should also note that Stop-App-on-Disconnect is checked in a2dpvolume.
Thanks!
Original comment by jonfield...@gmail.com
on 24 Apr 2012 at 4:52
A few more details... This car worked perfectly with Pandora using my older
HTC Incredible (what the Razr replaced). And the Razr works perfectly
delivering Pandora with my other car's GoGroove FlexSMART X2 Bluetooth system
($45 << HandsFreeLink).
Original comment by jonfield...@gmail.com
on 24 Apr 2012 at 5:00
Are you saying Pandora would stop correctly with the HTC? Is it just on the
razr that it does not stop?
Original comment by JimR...@gmail.com
on 24 Apr 2012 at 10:30
So I think you are saying the Razr works with the GoGroove (I have one of those
too) and the Incredible works OK witht he Honda but the Razr does not work with
the Honda. And, the only thing that does not work (Honda/Razr) is the stop app
feature. Please confirm. If this is correct, then it is something about the
Honda/Razr combination that is causing the problem. Are you using the Smart
Actions app? I wonder if either the Honda or the Razr toggles the music pause
and then my app toggles it again which sets it back playing. Try unchecking
the "stop app on disconnect" and see what happens. My app will still try to
stop the music but it won't try to kill the app. It should leave Pandora
active but paused so at least it is not playing. Let me know how that goes.
Original comment by JimR...@gmail.com
on 24 Apr 2012 at 11:22
I was using the Smart Actions app and have replaced it with a2dpvolume. Smart
Actions can start Pandora, if it was running and paused, on connection to the
HandsFreeLink, but it also could not stop it on disconnect. With the GoGroove
it would stop OK, but the start required hitting play on the GoGroove after the
car connected. a2dpvolume is a complete solution for the GoGroove, but the
HandsFreeLink has the problem as noted above. I will try unchecking "stop app
on disconnect" tomorrow with the HandsFreeLink. I think I did give that a try
today, but I'm not sure. BTW, the HandsFreeLink has intermittent instability
problems with recent Motorola phones which use the TI WL 1285C Bluetooth chip
(e.g. Razr). Interestingly enough, I could stabilize those problems by not
copying contact information into the HandsFreeLink. Sort of the worst kind of
problem in that it is not frequent enough to deter all users, and distracting
enough to possibly cause an accident.
Original comment by jonfield...@gmail.com
on 25 Apr 2012 at 2:36
I just posted 2.8.1 beta in the downloads page. Please test. I tested it on
Droid 3 and it now works.
Original comment by JimR...@gmail.com
on 25 Apr 2012 at 2:42
Issue 48 has been merged into this issue.
Original comment by JimR...@gmail.com
on 25 Apr 2012 at 3:48
Hi Jim, With 2.7.2 I tried turning off "stop app on disconnect" and that did
not fix the problem between my Razr and HandsFreeLink. With the phone unlocked
I see the same playing, paused, playing resumed with Pandora after the ignition
is turned off. Might a selectable, say 5 second delay, on the stop action,
which I assume is a start/pause toggle request, give HandsFreeLink and whatever
software on the phone is involved, a chance to finish their thing and allow
a2dpvolume to have the "last word" on play/pause? Should I try 2.8.1? Since
2.7.2 works perfectly with my GoGroove X2, I was a little reluctant to try
it... THANKS!!! Jon
Original comment by jonfield...@gmail.com
on 25 Apr 2012 at 1:42
Here I will explain how this works. If you don't know Java coding, you are
about to learn just a little bit. It is very similar to many other languages
and showing you the detail will hopefull help you understand it a bit better so
we can work threough what might be causing your problems. The first thing I do
is check to see if music is playing.
{{{if (bt2.hasIntent()) {
// if music is playing, pause it
if (am2.isMusicActive()) {
// first pause the music so it removes the notify icon
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
sendBroadcast(i);
// for more stubborn players, try this too...
Intent downIntent2 = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
KeyEvent downEvent2 = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_STOP);
downIntent2.putExtra(Intent.EXTRA_KEY_EVENT, downEvent2);
sendOrderedBroadcast(downIntent2, null);
}}}}
The above code checks to see if a package name is associated with the app to
launch. If you used a music playlist shortcut, no package name exists. I check
Pandora shortcuts though and automatically use the right package. The code
above will just stop the music be sending the KeyEvent which mimics you
pressing the stop button on the screen or via a Bluetooth device. The
HasIntent function is checking to make sure there is a real package name. This
is needed to be able to stop the app. Once the above is done, the app should
stop playing the music and remove the notify icon from the notification bar.
This is required to be able to push it to the background where it can finally
be stopped. This next part tries to kill the app.
{{{// if we opened a package for this device, try to close it now
if (bt2.getPname().length() > 3 && bt2.isAppkill()) {
// also open the home screen to make music app revert to
// background
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
// now we can kill the app is asked to
final String kpackage = bt2.getPname();
CountDownTimer killTimer = new CountDownTimer(6000, 3000) {
@Override
public void onFinish() {
try {
stopApp(kpackage);
} catch (Exception e) {
e.printStackTrace();
Log.e(LOG_TAG, "Error " + e.getMessage());
}
}
@Override
public void onTick(long arg0) {
if (am2.isMusicActive()) {
// first pause the music so it removes the notify icon
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
sendBroadcast(i);
// for more stubborn players, try this too...
Intent downIntent2 = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
KeyEvent downEvent2 = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_STOP);
downIntent2.putExtra(Intent.EXTRA_KEY_EVENT, downEvent2);
sendOrderedBroadcast(downIntent2, null);
}
try {
stopApp(kpackage);
} catch (Exception e) {
e.printStackTrace();
Log.e(LOG_TAG, "Error " + e.getMessage());
}
}
};
killTimer.start();
}
}}}
The first thing I do is open the home screen to force the app (Pandora in this
case) to the background. Since Android 2.2, an app cannot kill another app
unless it is in the background. Next I create a countdowntimer. This will run
the code in the onTick at the interval in the 2nd parameter (3000ms or 3
seconds in this case). The timer will call the onFinish piece of code once the
time expires in the first parameter (6000ms or 6 seconds in this case). In
these functions I am calling the code below (stopApp) to stop the app.
{{{ protected void stopApp(String packageName) {
Intent mIntent = getPackageManager().getLaunchIntentForPackage(
packageName);
if (mIntent != null) {
try {
ActivityManager act1 = (ActivityManager) this
.getSystemService(ACTIVITY_SERVICE);
// act1.restartPackage(packageName);
act1.killBackgroundProcesses(packageName);
List<ActivityManager.RunningAppProcessInfo> processes;
processes = act1.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo info : processes) {
for (int i = 0; i < info.pkgList.length; i++) {
if (info.pkgList[i].contains(packageName)) {
android.os.Process.killProcess(info.pid);
}
}
}
} catch (ActivityNotFoundException err) {
err.printStackTrace();
Toast t = Toast.makeText(getApplicationContext(),
R.string.app_not_found, Toast.LENGTH_SHORT);
if (notify)
t.show();
}
}
}
}}}
This will hunt down every process (PID) associated with the app and stop them
one by one.
So, this will first stop music from playing, then push the app to the
background, then this will try 3 times to kill the app waiting 3 seconds
between tries. I hope that helps. It sounds like in your case the very first
part does not work. The app does not see or does not respond to the stop key
event. I tested it here and it works fine on Droid 3. So this makes me wonder
if HTC has not implemented the stop key functionality in their UI. Or, maybe
something is restarting the play. Or, it is interpreting the stop key as a
toggle pause but the device you are disconnecting from is also toggling it. Or
maybe you have a device that only disconnects one profile but leaves the other
connected (common actually). Many Bluetooth car stereos will hold the
Bluetooth connecting active for many minutes after the key is OFF. Another
thought: are you turning OFF Bluetooth before you turn OFF the car? That would
cause this issue because I will never see this device disconnect. Instead I
will just see Bluetooth become disabled. You should just keep Bluetooth
enabled all the time. It takes very little battery.
Try using the audio jack or power connection features in A2DP Volume as a
virtual device. Have it launch Pandora just like you have it configured for
you car. See if that works correctly so we can isolate the issue more. This
will help determine if it is relate to killing the app or rather related to
Bluetooth.
Original comment by JimR...@gmail.com
on 25 Apr 2012 at 11:39
More info: I just duplicated your issue on my Xoom. It has ICS. It does not
seem to respond to the music stop either. Now that I have duplicated it, I can
work on fixing it and hope the fix for Xoom is the same for other devices too.
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 12:13
More info. The Xoom does not stop Pandora when using Home Dock but it does
work properly when using Audio Jack. Home Dock changes the UI. That could
explain the problem.
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 12:21
Issue 104 has been merged into this issue.
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 12:21
I am trying to get some more help on this here:
http://stackoverflow.com/questions/10326017/how-to-stop-or-pause-pandora-and-spo
tify
Hopefully someone can provide some more insight. I tested on Xoom, Droid 2,
and Droid 3. All work fine for power connection, audio jack,m and Bluetooth
devices. The Droid 2 and Xoom will not work with the Home Dock mode. They
launch OK but will not stop the player.
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 1:24
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 1:32
Original comment by JimR...@gmail.com
on 26 Apr 2012 at 11:09
Hi Jim, I'm not sure how to use a2dpvolume with my Droid Razr headphone jack,
but I can tell you the headphone jack stops Pandora perfectly if I pull it out
while playing Pandora after a normal manual start. My old HTC Incredible had
no problems with my HandsFreeLink Civic, and I very much missed that until I
discovered how well a2dpvolume works with a GoGroove X2 and my new Razr. I
would be excited to try a bug fix for my Razr/HandsFreeLink/a2dpvolume combo,
but I am very grateful for your application using my Razr and GoGroove!
Thanks! Jon
Original comment by jonfield...@gmail.com
on 26 Apr 2012 at 6:56
OK, I think I have it working now. Tested on Droid2, Droid3, and Xoom. All
now close Pandora on disconnect of any device type. Please test and report any
issues here.
One note: Pandora does not like being killed. It will not relaunch from A2DP
Volume once it has been killed by it until the device has settled a while.
I set it up so that you don't have to kill Pandora to pause it. What i do is
make Pandora thing you just disconnected your headphones. Pandora looks for
that to pause the music.
Original comment by JimR...@gmail.com
on 28 Apr 2012 at 2:28
Oops. Forgot to mention. I implemented the fix in 2.8.2 and that is ready for
testing in the downloads tab. Please test and report!
Original comment by JimR...@gmail.com
on 28 Apr 2012 at 2:29
Issue 88 has been merged into this issue.
Original comment by JimR...@gmail.com
on 28 Apr 2012 at 2:39
Hi Jim, Lots of good feedback on 2.8.2:
Mot Droid Razr + Honda Civic HandsFreeLink:
Starts and stops Pandora perfectly! For me it is perfect!!!
If I leave the phone unlocked when I turn off the ignition, I do see an error
message saying GoToMeeting has encountered a problem and Android wants me to
approve stopping it. I wish there was a low risk way to remove the
pre-installed apps I don't use. No remnants of this message if I don't have
the phone unlocked and look later.
Mot Droid Razr + GoGroove X2:
Does not start Pandora with restart application checked. Unchecked it works
perfectly.
THANKS!!!!
Jon
Original comment by jonfield...@gmail.com
on 28 Apr 2012 at 2:28
That for testing. Glad to hear it is all working well.
I don't think that GoToMeeting thing is related to my app. You can get rid of
that stuff with a one click root. Go here for details:
http://jimroal.blogspot.com/ . I would wait on the Razr until it gets updated
to ICS though. There are many threads on bloatware, forceware, crapware, etc
on Verizon's forums and other forums.
Original comment by JimR...@gmail.com
on 28 Apr 2012 at 8:42
I finally reinstalled Spotify to test and it appears to be working now too
(pauses and closes fine). Let me know if anyone still has trouble.
Original comment by JimR...@gmail.com
on 28 Apr 2012 at 9:14
Hi Jim, Just verified that application restart does not work with the Honda
HandsFreeLink either, and that choosing a Pandora Radio Station does not seem
to work beyond starting Pandora and playing whatever was last selected.
Regardless Iam quite happy and hope these little details help you. Thanks! Jon
--------
BTW I briefly owned a Samsung Galaxy Nexus with ICS and found it too buggy.
Maybe the apps and ICS have matured since last December. I was thinking I
would not let Verizon update my Razr to ICS when that day came, given
everything is working well, with a2dpvolume covering the last of my issues...
Original comment by jonfield...@gmail.com
on 29 Apr 2012 at 3:08
The functionality of restart app is app dependent. Some work better that way,
others do not. The option is there so you can find what works best for the app
you are using. It does not work well with Pandora so you should never use it
with Pandora. Always leave it unchecked with Pandora. On other players, it
does help.
Starting the wrong station is a defect. I will post a new issue for this one.
Thanks for letting me know. I never use Pandora so I don't have these issues.
That's why it really help to have people like you test and report. Thanks a
bunch!
I have ICS on my Xoom and it is not buggy at all. ICS has been upgraded on the
Nexus since release too. I have friends with it and they like it. If it were
me I would take the upgrade when it comes. However, your point is certainly
valid. If everything is working well for you, why change.
Original comment by JimR...@gmail.com
on 29 Apr 2012 at 3:17
I launched issue 108 for the Pandora issue. When I first tested it, I thought
it did just like you said: opened Pandora to the last station. However, I
tried it numerous times since and it always worked correctly, it switched to
the station I selected. Make sure you uncheck app restart and retest for this
problem. Report results in issue 108 please.
Original comment by JimR...@gmail.com
on 29 Apr 2012 at 3:28
Fixed with 2.8.5.
Original comment by JimR...@gmail.com
on 30 Apr 2012 at 10:12
Hi Jim, My phone auto upgraded to 2.8.5 from 2.8.2 and has had problems
starting and stopping Pandora, with settings that worked fine yesterday with
2.8.2. It was only able to start Pandora correctly once today. All the other
times Pandora was not running at all, or running paused. Stopping stopped
working after I tried a phone reset for starting. I plan to revert back to the
older version unless you waive me off from that. Thanks! Jon
Original comment by jonfield...@gmail.com
on 1 May 2012 at 10:22
Verizon just sent a new build to my phone (still Android 2.3.6). I'll give
2.8.5 another day of system test before rolling back. Thanks, Jon
Original comment by jonfield...@gmail.com
on 2 May 2012 at 12:10
Strange. I made no changes to that part of the code between 2.8.2 and 2.8.5.
Of course I keep all the old version in the downloads area on this website. If
reverting does fix it, please let me know.
Original comment by JimR...@gmail.com
on 2 May 2012 at 12:42
2.8.5 has worked perfectly, absolutely no issues for a full day of many stops,
which I've never achieved with any cell phone with this car, since the new
build was downloaded (Droid Razr 6.12.181.XT912.Verizon.en.US). Thanks! Jon
Original comment by jonfield...@gmail.com
on 3 May 2012 at 10:21
Original issue reported on code.google.com by
jonfield...@gmail.com
on 24 Apr 2012 at 4:50