android - 为 Froyo 2.2 Droid 添加启动声音

标签 android audio boot android-2.2-froyo

我一直在尝试在启动时添加声音,以便在运行 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/

相关文章:

android - 如何在我的 Android 应用程序中播放 YouTube 视频?

android - 4,5秒后流音乐中断

Javascript - 仅当 div 在 DOM 中可见时才播放音频

x86 - 什么存储器用于存储复位向量?

java - 如何在 getActivity 变为 null 时终止线程

android - SQLite 选择所有表 DESC

android - 如何在Timer中使用OpenGL

c - 掌握Windows 10的声音管理

kernel - 从 Fedora 14 升级到 15 后服务器掉落到 dracut 调试 shell

kernel - 我的操作系统内核在 D : Some embedded strings don't work