iPhone sometimes goes to sleep running Pandora, sometimes doesn't I use my iPhone4 to listen to Pandora radio at work. I have it plugged in to a standard charge/sync cable, and a headphone jack to my speakers.

Sometimes the screen stays on indefinitely, showing me the current album in the Pandora app. Sometimes, it goes to sleep, and I have to manually unlock it to see the current album. Seems about 50/50, and I have no idea why it sometimes stays on and sometimes doesn't.

How can I get it to stay on, and not go to sleep (I do want it to go to sleep normally when I'm not using it for music, however)

Not sure if this is specific to Pandora, or if I'd see the same issue with the iPod app.
I figured out a reliable way to make sure the phone doesn't go to sleep while running Pandora:


Launch Pandora
Insert headphone jack
Connect dock/power cable


If I dock the power cable before launching Pandora, then the screen will go to sleep.

Still not sure why it does this, or if it is specific to the Pandora app, but hopefully this will help someone else out :)