• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Audio player

tenz

Lurker
Oct 14, 2010
2
0
First off, please forgive me. I am a complete noob in the world of android and eclipse.

I am trying to write an app that
- Will play an .mp3 and gets called from adb shell.
- I need the audio to play in the background (I don't ever want the app to be visible to the user).
- I need to be able to 'mix' audio files (song B plays on top of song A).

In my research I have read that the way to do this on Android is as a Service, but I have not been able to figure one out. I am using Eclipse. Below is the Activity that I have written. I call it from adb shell using this:
am start -n com.icon.mediaplayer/.play -d "/mnt/sdcard/here.mp3"

Can anyone offer me some advise?

package com.icon.mediaplayer;

import android.app.Activity;
import android.os.Bundle;
import java.io.IOException;
import android.util.Log;

public class play extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

try {
Global.mp.reset();
Global.mp.setDataSource( this.getIntent().getDataString() );
//Global.mp.setDataSource( "/mnt/sdcard/here.mp3" );
Global.mp.prepare();
Global.mp.start();
} catch(IOException e) {
Log.v(getString(R.string.app_name), e.getMessage());
}
}
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones