2010-12-15 6 views
0

스트리밍 서버에서 오디오를 재생하는 응용 프로그램에서 인 텐트를 시작하려고합니다. 그 스트림의 URL을 가지고 나는 (내가 bit.ly없이 시도와 같은 결과를 가지고 한)Android 앱에서 오디오 링크를 실행할 수 없습니다.

intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://bit.ly/gKltQE")); 
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // i tried with and without this, no luck 
startActivity(intent); 

브라우저가 시작, 부하 시작하는 URL을 단순화하기 위해 bit.ly 사용하고 있습니다 오디오 링크가 다음 닫고 내 응용 프로그램에 반환 내가 수동으로 브라우저에서 동일한 bit.ly 링크를 실행하면 잘 작동

12-15 14:27:58.559 1259 8370 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW dat=http://bit.ly/gKltQE flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } 
12-15 14:14:23.903 1259 1383 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://216.235.81.102:15532/play?now=65&membername;=&session=kxlu1:0&tag=live365&s=kxlu1&d=live365&r=0&app_id=live365:BROWSER%28pro%29 cmp=com.android.browser/.BrowserActivity } 
12-15 14:14:24.387 8848 8848 D webviewglue: nativeDestroy view: 0x3bb018 
12-15 14:14:24.387 1259 1600 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW dat=http://216.235.81.102:15532/play?now=65&membername;=&session=kxlu1:0&tag=live365&s=kxlu1&d=live365&r=0&app_id=live365:BROWSER%28pro%29 typ=audio/mpeg cmp=com.android.music/.StreamStarter } 
12-15 14:14:24.387 1259 1929 I ActivityManager: moveTaskToBack: 12 

은 (오디오 스트리밍 응용 프로그램을 실행)에 bit.ly 링크까지 리디렉션 :

12-15 14:26:21.403 8848 8848 D SearchDialog: launching Intent { act=android.intent.action.VIEW dat=http://bit.ly/gKltQE flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } 
12-15 14:26:21.411 8848 8848 I SearchDialog: Starting (as ourselves) http://bit.ly/gKltQE#Intent;action=android.intent.action.VIEW;launchFlags=0x10000000;component=com.android.browser/.BrowserActivity;S.query=http%3A%2F%2Fbit.ly%2FgKltQE;S.user_query=bit;end 
12-15 14:26:21.411 1259 1259 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW dat=http://bit.ly/gKltQE flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) }12-15 14:26:21.879 1259 1267 V DeviceStorageMonitorService: freeMemory=6210887680 
12-15 14:26:21.879 1259 1267 V DeviceStorageMonitorService: Threshold Percentage=10 
12-15 14:26:21.879 1259 1267 V DeviceStorageMonitorService: mTotalMemory = 70264913 
12-15 14:26:21.879 1259 1267 I DeviceStorageMonitorService: Posting Message again 
12-15 14:26:21.997 8848 8864 D dalvikvm: GC_FOR_MALLOC freed 14790 objects/467656 bytes in 85ms 
12-15 14:26:22.192 1259 1436 D dalvikvm: GC_FOR_MALLOC freed 47823 objects/2142584 bytes in 154ms 
12-15 14:26:22.208 1259 1263 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://216.235.81.102:15532/play?now=65&membername;=&session=kxlu1:0&tag=live365&s=kxlu1&d=live365&r=0&app_id=live365:BROWSER%28pro%29 cmp=com.android.browser/.BrowserActivity } 
12-15 14:26:22.676 1259 1259 I ActivityManager: Starting activity: Intent { act=android.intent.action.VIEW dat=http://216.235.81.102:15532/play?now=65&membername;=&session=kxlu1:0&tag=live365&s=kxlu1&d=live365&r=0&app_id=live365:BROWSER%28pro%29 typ=audio/mpeg cmp=com.android.music/.StreamStarter } 
12-15 14:26:22.770 1259 8719 I AudioService: Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.android.music/com.android.music.MediaButtonIntentReceiver} 
12-15 14:26:22.801 8217 8217 V MediaPlaybackService: reloadQueue end 
12-15 14:26:22.809 8217 8217 V MediaPlaybackService: onCreate end 
12-15 14:26:22.809 8217 8217 V MediaPlaybackService: onStartCommand end 

다양한 intent.setFlags 매개 변수를 사용하여 보면서 시도했지만 아무 소용이 없습니다. 어쩌면 권한 문제일까요? 또는 startActivity를 호출하는 방법과 관련이 있습니까?

답변

3

사용 권한 문제가 아니라 현재의 탭이 없기 때문에 BrowserActivity가 조기에 끝났습니다. 다른 플래그가 필요하지 않습니다

intent.setType("audio/mpeg"); 

... 사운드 플레이어 (또는 미디어 플레이어 : 할 수있는 가장 좋은 방법은 데이터를 처리해야하는 브라우저가 실제로 아니라고 텐트 해결에 추가 단서를 제공하는 것입니다 선택) 이제 처리 할 수 ​​있습니다.

+0

아, 감사합니다. 그걸 제대로하지는 않았지만 올바른 방향으로 나를 가리켰다. 나는 intent = new Intent (Intent.ACTION_VIEW)라고 부를 필요가 있었다. intent.addCategory (Intent.CATEGORY_DEFAULT); intent.setDataAndType (uriObj, mimeType); "setDataAndType"호출에 관한 문제가 필요합니다. 너무 이상해. – Eric

관련 문제