java.io.IOException: Prepare failed.: status=0x1

Appcelerator JIRA | Eduardo Gomez | 5 years ago
  1. 0

    h5.Problem If you add a sound to a notification the sound is not found. http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.NotificationManager-module h5.Repro sequence {code:title=app.js} var win= Titanium.UI.createWindow(); var btn = Ti.UI.createButton({ title: 'Add Notification' }); btn.addEventListener('click', function(e) { var activity = Ti.Android.currentActivity(); var intent = Ti.Android.createIntent({ }); var pending = Ti.Android.createPendingIntent({ 'activity' : activity, 'intent' : intent, 'type' : Ti.Android.PENDING_INTENT_FOR_ACTIVITY, 'flags' : 1073741824 }); var ts = new Date().getTime(); var notification = Ti.Android.createNotification({ contentIntent : pending, contentTitle : 'Test', contentText : 'test', when : ts, //icon: 'KS_nav_ui.png',TIMOB-4651 sound: '1.mp3', defaults: Titanium.Android.NotificationManager.DEFAULT_VIBRATE }); Ti.Android.NotificationManager.notify(1, notification); }); win.add(btn); // testing if the image exist var lbl = Titanium.UI.createLabel({ text : ' ', backgroundImage: 'KS_nav_ui.png', top : 10, left: 10 }); win.add(lbl); win.open(); {code} h5.Console Output - With customized Sound Sound file is located at resources folder, so property is being set as: sound: '1.mp3' {noformat} I/StagefrightPlayer( 34): setDataSource('/android_asset/Resources/1.mp3') E/MediaPlayer( 60): error (1, -2147483648) W/NotificationService( 60): error loading sound for file:///android_asset/Resources/1.mp3 W/NotificationService( 60): java.io.IOException: Prepare failed.: status=0x1 W/NotificationService( 60): at android.media.MediaPlayer.prepare(Native Method) W/NotificationService( 60): at com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:90) {noformat} h5.Tested on Device: HTC Dream Android 2.2 OS version & Emulator: Android HGVA h5.Associated HD ticket PRO - http://appc.me/c/APP-923324 h5.Additional info Get default vibrate by setting permissions in Tiapp.xml {noformat} <android xmlns:android="http://schemas.android.com/apk/res/android"> <manifest> <uses-permission android:name="android.permission.VIBRATE"></uses-permission> </manifest> </android> {noformat} h5.Work Around To allow the app at this time to play the default sound and vibration as well: defaults: Titanium.Android.NotificationManager.DEFAULT_ALL To play default sound: defaults: Titanium.Android.NotificationManager.DEFAULT_SOUND To get phone vibration: defaults: Titanium.Android.NotificationManager.DEFAULT_VIBRATE

    Appcelerator JIRA | 5 years ago | Eduardo Gomez
    java.io.IOException: Prepare failed.: status=0x1
  2. 0

    MediaPlayer: Prepare failed status 0x1 error while streaming song

    Stack Overflow | 3 years ago | Bersh
    java.io.IOException: Prepare failed.: status=0x1
  3. 0

    Accessing internally stored media files - MediaPlayer on Android

    Stack Overflow | 3 years ago | Sriram
    java.io.IOException: Prepare failed.: status=0x1
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Android MediaPlayer - error (1, -4) when playing a song

    Stack Overflow | 3 years ago | Hanady
    java.io.IOException: Prepare failed.: status=0x1
  6. 0

    Code is not playing any audio

    Stack Overflow | 3 years ago | user2714061
    java.io.IOException: Prepare failed.: status=0x1

  1. bluebunnty 6 times, last 2 weeks ago
  2. ank_07 2 times, last 4 months ago
5 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    Prepare failed.: status=0x1

    at android.media.MediaPlayer.prepare()
  2. Android Platform
    MediaPlayer.prepare
    1. android.media.MediaPlayer.prepare(Native Method)
    1 frame
  3. Android
    NotificationPlayer$CreationAndCompletionThread.run
    1. com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:90)
    1 frame