我一直在尝试在启动时添加声音,以便在运行 Froyo 2.2 ROM 的机器人上与启动动画一起运行。
这是我到目前为止尝试过的:
添加到 init.rc
###Bootsound - Safe to Delete: Start ###
service bootsound /system/bin/bootsound
user media
group audio
disabled
oneshot
on property:init.svc.bootanim=running # to correct timing
start bootsound
on property:dev.bootcomplete=1
stop bootsound
### Bootsound - Safe to Delete: End ###
在/system/bin 中创建了引导声音
#!/system/bin/sh
#bootsound - plays a sound at boot
bprop=/system/build.prop
grepprop() { x=`grep "^$1=" $bprop | head -n 1`; echo $x | cut -d = -f 2; }
play=`grepprop "ro.config.play.bootsound"`
if [ "$play" = "1" ]; then
stagefright -a -o /system/media/android_audio.mp3
fi
exit 0
添加到 build.prop
### Safe to Delete: Start ###
ro.config.play.bootsound=1
### Safe to Delete: End ###
当然还有将 android_audio.mp3 文件添加到/system/media
运气不好,谁能发现我可能遗漏了什么?
谢谢
最佳答案
第一个英文翻译,抱歉使用了单点。 当试图看到您的帖子应用于 Android 2.3 GingerBread bootsound 时发现问题确实发生了。 Bootsound在Boot Device过程中,遇到如下错误。
bootsound: 12: 语法错误: 意外的文件结束(期待“then”)
当前使用的设备是 LG Optimus Black (Android 2.3 Gingerbread)
关于android - 为 Froyo 2.2 Droid 添加启动声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3437527/