1

アラームの着信音を再生しようとしています。ただし、ランダムな秒数後に再生が停止し、着信音全体が再生されるわけではありません。誰がこれを引き起こす可能性があるか知っていますか?

コードは私自身のものではありません。これは調査済みのソリューションです。

Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
                        if(alert == null){
                            // alert is null, using backup
                            alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                            if(alert == null){  // I can't see this ever being null (as always have a default notification) but just in case
                                // alert backup is null, using 2nd backup
                                alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);               
                            }
                        }
                        Ringtone a = RingtoneManager.getRingtone(getApplicationContext(), alert);
                        a.play();

このイベントは、ボタンが押されたときに発生します。ありがとう!

AVD からのみ stacktrage を印刷できますが、そこにはサウンドファイルがありません。

08-05 19:39:43.093: D/dalvikvm(611): GC_CONCURRENT freed 370K, 17% free 2526K/3016K, paused 5ms+52ms, total 230ms
08-05 19:39:43.093: W/ActivityManager(281): Unbind failed: could not find connection for android.os.BinderProxy@40e841e8
08-05 19:39:47.843: D/dalvikvm(781): GC_CONCURRENT freed 595K, 14% free 4530K/5256K, paused 24ms+23ms, total 94ms
08-05 19:39:55.403: D/dalvikvm(781): GC_CONCURRENT freed 586K, 14% free 4532K/5252K, paused 6ms+4ms, total 64ms
08-05 19:40:00.383: D/MediaPlayer(781): Couldn't open file on client side, trying server side
08-05 19:40:00.393: E/MediaPlayerService(40): Couldn't open fd for content://settings/system/alarm_alert
08-05 19:40:00.403: E/MediaPlayer(781): Unable to to create media player
08-05 19:40:00.403: D/Ringtone(781): Problem opening; delegating to remote player
08-05 19:40:00.413: D/dalvikvm(341): GREF has increased to 201
08-05 19:40:00.423: D/MediaPlayer(341): Couldn't open file on client side, trying server side
08-05 19:40:00.443: E/MediaPlayerService(40): Couldn't open fd for content://settings/system/alarm_alert
08-05 19:40:00.443: E/MediaPlayer(341): Unable to to create media player
08-05 19:40:00.443: W/Ringtone(341): Remote playback not allowed: java.io.IOException: setDataSource failed.: status=0x80000000
08-05 19:40:00.443: D/Ringtone(341): Problem opening; delegating to remote player
08-05 19:40:00.453: W/Ringtone(341): Neither local nor remote playback available
08-05 19:40:06.553: D/dalvikvm(781): GC_CONCURRENT freed 585K, 14% free 4537K/5252K, paused 6ms+4ms, total 90ms
08-05 19:40:19.173: D/dalvikvm(781): GC_CONCURRENT freed 583K, 14% free 4541K/5252K, paused 5ms+18ms, total 92ms

Media Player の方法については。私もそれを試しました。同じ問題。

4

0 に答える 0