Android :: How To Use Dpad Button To Pause / Play Audio While Device Locked?
Nov 24, 2009
I have an application that is playing audio, and I would like to allow the listener to toggle between pause and play while the screen is locked, as it is a hassle to have to unlock the screen in order to pause the audio playback. Is there any way to monitor for KeyEvent.KEYCODE_DPAD_CENTER while the the screen is locked? I have been looking through the documentation but have not found any information on how to do this.
View 12 Replies
Nov 22, 2010
is there a way to change songs on the screen when the screen is locked? Is there an app to change this? Its tedious having to unlock the screen everytime you want to pause/skip songs.
View 3 Replies
View Related
Mar 26, 2014
Anyways, whenever i'm listening to music, and I press the play/pause button on my headset to control my music tracks, my phone turns on. This get's really annoying because every time my phone turns on, it stays on for a few seconds, and this really kills battery life. I've tried lurking around my phone's settings and even my launcher settings.
My phone is a rooted HTC Wildfire S running AOKP custom rom with Nova Launcher Prime. And if it makes any difference, I'm using the "Start" lock screen from the Play Store.
View 6 Replies
View Related
Apr 22, 2010
I have this problem, I have some audio I wish to play. And I have two buttons for it, 'Play' and 'Stop'.Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code:final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth);And then the two public onclicks: For playing)
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
button.setText("Playing!");
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
And for stopping the track
final Button button2 = (Button) findViewById(R.id.cancel);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mp.stop();
mp.reset();
Can anyone see the problem with this? If so could you please fix it. (For suggest)
View 3 Replies
View Related
Aug 20, 2010
How to put on pause? I have not found such a function. There are other ways?
View 1 Replies
View Related
Feb 24, 2010
I keep hearing that last.fm is better than Pandora, so I'm trying it out. But no pause button? Is this only for people who live in caves?
View 6 Replies
View Related
Jun 2, 2009
Could you please let me know how to do the audio record in android emulator and play the same recorded audio. Could you please help me in proceeding in development.I tried with MediaPlayer API's also.Its not working.
View 5 Replies
View Related
Oct 25, 2012
I own a GSM Galaxy Nexus and I picked up the official car dock yesterday, and I've noticed that it doesn't have an elegant method for pausing currently playing media when a disconnect is detected, like how when you unplug a headset and supported media apps will pause (e.g. Pandora or Google Music).
EDIT: Originally I was using Tasker's built-in media button functionality for pausing music, but that actually was triggering a global play/pause toggle which would toggle all apps at the same time, resulting in unwanted resumed playback from Pandora and Google Music. I managed to resolve the issue by using the Locale Headphone Button Plugin instead. With it I can issue a non-toggle pause event that only pauses tracks that are currently playing. There is absolutely no need to simulate a headset event.
View 1 Replies
View Related
Nov 25, 2010
For some reason.. my stock htc headphones wont forward rewind.play or pause.. the default music player! they do work cuz they play/pause mspot and double twist... i unistalled both restarted my phone.. took out the battery.. im about too reset it soon.. but just wondering if any other HTC desire Z owners have experienced a similar problem and found a solution (i've searched and found no1 with a similar problem.. must be in my settings or something).
View 2 Replies
View Related
Oct 25, 2010
Basically I have created a blackjack game (first using just java) and it falls under an infinite while loop (this is so that the deck data is kept and everything works well. So first it deals the cards and then it needs to wait for either the hit button (which is displayed) or the stand button (which is displayed) to be clicked. I initially did this with a while loop that would keep checking if buttons were hit (basically when a button was hit, a static int would change and stuff would occur). However this just causes the droid to freeze up (thus far anyway) and also not refresh. So please someone tell me there is some way I can have my method pause until a button is pressed? I also need to know the proper way to use invalidate() so that my textviews, pictureviews and such can be updated as the methods change them.
View 3 Replies
View Related
May 5, 2010
I connected my phone via USB to my RR sport to upload audio files to the RR hard drive. However, I keep getting connection error. Apparently my device is not being recognized as a storage. I did the unmount thinking. Also, I am wondering how I can play audio from my phone through the RR audio system.
RR is 2010.
View 2 Replies
View Related
Oct 7, 2012
Is there any option to pause downloading from Google play store? I don't have fast connection and sometimes when downloading , I need to do something else and only can cancel download.
View 4 Replies
View Related
Jul 12, 2012
Currently android devices play/pause on audio cable plugin. But I need it to do the exact same thing with the charge cable. Mainly because I use a dock for music playback on one of my stereo's and would like to just drop it into the dock and it will start playing, or pull it and it will pause
View 1 Replies
View Related
Sep 11, 2009
I've been able to lock the screen twice with the current implementation of the app I'm writing (MediaDroid). It's very inconsistently (2 out of about 100 runs) and I'm not sure how to trigger it, so I'm assuming it's some sort of race condition or the number of threads I'm spawning.
The activity I'm working on loads a gallery of thumbnails from the sdcard. I believe I'm using most of the best practices described by Romain Guy from his Google I/O talk "Make your Android UI Fast and Efficient". I've implemented an image cache with SoftReferences wrapping my Bitmaps and created an Efficient Adapter for the gallery using the ViewHolder pattern.
What I am doing, which I question, is loading each image via a thread as it is retrieved from the ImageCache...I pass back a default image if the bitmap is null, then update the default image in the ImageViews with the Bitmap is loaded from the sdcard; I'm doing this by posting to a Handler in the Adapter from the thread that loads the image.
So as you can imagine a number of threads are created, about 25 at a time, as the user swipes through the image gallery. Once the user reaches the end of the gallery, the images are only reloaded if the garbage collector has collected them due to the SoftReference. I've been impressed by how well this worked....until the bug mysteriously started appearing. What has happened both times is, all the images in the gallery show the default images, then I get an ANR and with the force close or wait option, I hit force close and the ANR dialog shrinks (but doesn't go away) and the background goes black...then everything just freezes...here's the logs where I believe things start to lock up.
CODE:......
If I press on the screen I get nothing on the device, but in the logs I get
CODE:........
And I have to power down the device.
So if the number of threads is the problem I'm thinking of loading all the bitmaps when the app is first initiated, probably using the AsyncTask class. A question I have though about this is that the docs say that you can only call execute() once...what's happens if some of my Bitmaps are garbage collected?? Do I then call individual threads to reload? I've looked through some of the Google apps, Shelves and Photostream, but they don't seem to be using Bitmaps wrapped in SoftReferences.
View 5 Replies
View Related
Dec 28, 2009
Hey guys, I just bought the Jabra BT8040 and I have it paired up with my Droid, however I can't figure out how to pause/play music with it. I can hear the music fine but the end/answer button doesn't pause or play the music
View 2 Replies
View Related
Apr 28, 2010
I took out the 8GB SD card from my Blackberry Storm and put it the Incredible.
I had a bunch of music saved on my SD Card that I downloaded from VZW Music Media thing.
When I go to music on the Incredible and go over the song (it shows the picture of the album of the song)
it says "unable to play this type of audio"
View 10 Replies
View Related
Nov 12, 2010
I am working on a application that would allow users to play remote files. My question is how do I open those remote files to be played in the default android player?but this does not give me control of what is happening!
View 2 Replies
View Related
Jun 10, 2010
In the past, when listening to music on my Incredible, if I locked the phone the music would continue to play just fine. If I wanted to pause/play/skip a song, all I had to do was hit the power button and above the "Slide to unlock" bar there was a music control bar.
Now, my music still plays, but those buttons are gone from the lock screen. This is a pain because in order to pause my music when someone comes to my desk at work I have to hit the power button, unlock the phone, slide down the notifications window, wait for the music app to load then hit pause.
Anyone know how to get these buttons back?
View 2 Replies
View Related
Mar 5, 2010
We have ported Android Eclair on our target. After booting the Android and unlocking the screen first time, if we press the 'call end' button then the home screen gets locked. And we are not able to unlock it. Has anyone observed this behavior on their platform? How to unlock the screen? Is this a special feature?
View 2 Replies
View Related
Nov 9, 2009
The camera button just sits there useless until the camera is used. How about letting us map that to a function? Personally, I would like to be able to use it as a Pause/Play toggle. When I am out and about listening to music, I very often need to pause. Currently, this requires pulling out the phone, pressing the power button, swiping it open, and (if the music screen is up) pressing pause. That is WAY too long, and a simple hardware button would be perfect.
View 1 Replies
View Related
Apr 7, 2010
I'm hoping for some pointers. I simply want two buttons.. nothing more, to allow me to control my music.I know, I know. "Why not just use the music widget?" Cause it's ugly (in my opinion).With Bettercut, I'm aware that you can create your own shortcut, but you have to have the source code or some sort of.androidaction.blah in order to create it. I'm just curious if I could use that or if there's something out there that's better.I don't need to know the artist or the song that's playing, I just, well, I miss the days of double clicking my home button and hitting next or stop with my iPhone. That's what it boils down to. So, if there's a way to get the music controls on the lock screen... well, that would even be better.Anyone have some suggestions? I have searched and searched for some sort of resolution, but it's been to no avail. Or, I could have just been searching for the wrong thing.
View 6 Replies
View Related
Jul 5, 2013
Is there any options to get back into your locked device without having to do a factory Data Reset. I have a 3D HTC EVO. I have not created a gmail acct with google on it. What options do I have?
View 4 Replies
View Related
Jun 11, 2010
I want you guys to test the new email notifications when the device is connected through WiFi.
For this you've to set the WiFi sleep policy to never and the Background and Auto sync option needs to be checked.
Well, I don't get any notifications. I went an extra mile ahead and pinged the IP address and found that I get "request timed out" error when device is locked and when it is unlocked, the packets are received properly.
View 3 Replies
View Related
Mar 4, 2012
i have a button setup to play a sound,but nothing plays until i release the button again. here's my code
Code:
bKick.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
sp.play(dance_kick, 1, 1, 1, 0, 1);
}
});
View 8 Replies
View Related
Nov 13, 2009
I am always changing the volume accidentaly, especially while I am streaming Pandora or slacker when my screen is locked. Also I keep accidentaly turning my ringer down. Is there a way to totally disable the volume buttons or at least make them less annoying?
View 3 Replies
View Related
Aug 2, 2010
When the phone is locked, but the screen is on, if you hold down the search button for a couple of seconds and then say something, the voice search will run. when you unlock the phone, you will see the results. when the screen is off however, it doesn't work. it only happens with the screen on and the phone locked. i thought that none of the buttons should work when the phone is locked?
View 2 Replies
View Related
Feb 10, 2010
How to play audio from a stream in android? I will get input stream from an online link( like continuous FM). I need to cache the stream and play it. I searched a lot in sites,,,but didnt get.They show option of playing from a stored file. There is no option to play from a stream.
View 12 Replies
View Related
Jan 22, 2010
I currently have code that reads a recording in from the devices mic using the AudioRecord class and then playing it back out using the AudioTrack class.My problem is that when I play it out it plays vis the speaker phone.I want it to play out via the ear piece on the device.Here is my code:public class LoopProg extends Activity {
boolean isRecording; //currently not used
AudioManager am;
int count = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
am.setMicrophoneMute(true);
while(count <= 1000000){
Record record = new Record();
record.run();
count ++;
Log.d("COUNT", "Count is : " + count);
public class Record extends Thread
{ static final int bufferSize = 200000;
final short[] buffer = new short[bufferSize];
short[] readBuffer = new short[bufferSize];
public void run() {
isRecording = true;
android.os.Process.setThreadPriority
(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
int buffersize = AudioRecord.getMinBufferSize(11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
AudioRecord arec = new AudioRecord(MediaRecorder.AudioSource.MIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
buffersize);
AudioTrack atrack = new AudioTrack(AudioManager.STREAM_MUSIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
buffersize,
AudioTrack.MODE_STREAM);
am.setRouting(AudioManager.MODE_NORMAL,1,
AudioManager.STREAM_MUSIC);
int ok = am.getRouting(AudioManager.ROUTE_EARPIECE);
Log.d("ROUTING", "getRouting = " + ok);
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
//am.setSpeakerphoneOn(true);
Log.d("SPEAKERPHONE", "Is speakerphone on? : " + am.isSpeakerphoneOn());
am.setSpeakerphoneOn(false);
Log.d("SPEAKERPHONE", "Is speakerphone on? : " + am.isSpeakerphoneOn());
atrack.setPlaybackRate(11025);
byte[] buffer = new byte[buffersize];
arec.startRecording();
atrack.play();
while(isRecording) {
arec.read(buffer, 0, buffersize);
atrack.write(buffer, 0, buffer.length);
arec.stop();
atrack.stop();
isRecording = false;
As you can see if the code I have tried using the AudioManager class and its methods including the deprecated setRouting method and nothing works, the setSpeatPoneOn method seems to have no effect at all, neither does the routing method.Has anyone got any ideas on how to get it to play via the earpiece instead of the spaker phone?
View 5 Replies
View Related
Feb 22, 2010
I need to be able to stream audio from a custom file format on the C++ side of the Android system. I am working on porting a custom media player and need to be able to open a custom file and stream audio from it. This is important as I do not think porting the whole player to JAVA is feasible from a performance stand point and moving the audio buffers through the JNI interface I believe will be too slow to keep a decent frame rate. I can handle the video on the NDK side through OpenGL ES, but the Audio I have no idea how to make this happen.
View 2 Replies
View Related
Jul 12, 2010
I need to download audio from web server and I need to save into device memory. Then, I need to play that audio from my application. I know, how to play audio if that is available in res/raw folder. But, I can't able to play audio from SD Card. I am getting following error: ERROR/PlayerDriver(31): Command PLAYER _ SET _ DATA _SOURCE completed with an error or info PVMFErr Not Supported.
View 4 Replies
View Related