public class MyService extends Service{
MediaPlayer player;
public IBinder onBind(Intent arg0) {
return null;
}
/*This Service used for Playing Music when any task is coming*/
public void onCreate()
{
super.onCreate();
player = MediaPlayer.create(MyService.this, R.raw.iphone_4s_new_2011);
player.start();
player.setLooping(true);
System.out.println("songggggggggggggggggggggggggggggggggggggggggggg");
}
@Override
public void onDestroy()
{
super.onDestroy();
player.stop();
player.release();
}
}
startService(new Intent(this, MyService.class));
MediaPlayer player;
public IBinder onBind(Intent arg0) {
return null;
}
/*This Service used for Playing Music when any task is coming*/
public void onCreate()
{
super.onCreate();
player = MediaPlayer.create(MyService.this, R.raw.iphone_4s_new_2011);
player.start();
player.setLooping(true);
System.out.println("songggggggggggggggggggggggggggggggggggggggggggg");
}
@Override
public void onDestroy()
{
super.onDestroy();
player.stop();
player.release();
}
}
startService(new Intent(this, MyService.class));
No comments:
Post a Comment