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());
}
}
}
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());
}
}
}