android.intent.action.VIEW 为什么只能接收一次
使用了静态注册的方法,从文件管理器打开音乐的某一首歌曲,第一次是没有问题的,第二次,就不能收到
android.intent.action.VIEW,参考代码如下,请问有同仁遇到此现象没有,请指教,谢谢
private void initService() {
fileIntent = getIntent();
Log.d(TAG,"fileIntent " + fileIntent.toString());
serviceIntent = new Intent(this, MusicPlayerService.class);
musicUri = fileIntent.getData();
try {
if (musicUri != null) {
musicUri = Uri.parse(URLDecoder.decode(musicUri.toString(),
"UTF-8"));
serviceIntent.setData(musicUri);
Log.v(TAG, "User select uri:" + musicUri.toString());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// handler.post(ablumRunnable);
serviceIntent.putExtra("intentService", MusicDef.MUSICACTIVITY);
// intent.putExtra("background_mode", bkgmode);
startService(serviceIntent);
bindService(serviceIntent, musicServiceConn, Context.BIND_AUTO_CREATE);
serviceIntent.setData(null);
}