Web から重いファイルをダウンロードするサービスを使用していますが、ファイルのダウンロード中にアプリを操作できません。これに最適な方法は何ですか。 約 10 MB のファイルをダウンロードしており、ファイルのダウンロード中にユーザーがアプリを操作できるようにしたい サービス コードを見つけてください。
public static class MyService extends Service {
@Override
public IBinder onBind(Intent arg0) {
return null;
}
public MyService(){
super();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Let it continue running until it is stopped.
System.out.println("service started");
Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
//Toast.makeText(Description.this, "Downloading content...", Toast.LENGTH_LONG);
GetShowsInfo(downloadEpisodeMedia(episode_id));
RequestDownloads();
File cacheDir=new File(android.os.Environment.getExternalStorageDirectory(),"Folder Name");
listf(cacheDir,files);
mediaPlayerflag=true;
//progressBarLayout.setVisibility(LinearLayout.VISIBLE);
nowPlayingEpisode=categoryName;
//NowPlayingEpisode.setText("Now Playing "+episodeArrayList.get(position).getName());
textView_MediaPlayer.setText(nowPlayingEpisode);
//textView_EpisodeCount.setText(episodeCount);
playOnebyOneMedia();
// StoreInfo(GetCategories());
//StoreDescription(GetDescription());
return START_STICKY;
}
@Override
public void onDestroy() {
System.out.println("service stopped");
super.onDestroy();
Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
}
}