模拟接听电话时的振动
所以我试图模拟手机正在接听电话。我已成功提取手机铃声并播放。现在我想模拟振动。虽然我可以让手机振动,但我想模拟手机接到电话时振动的确切模式。是否有一些设置或类可以用来提取此模式,并检测振动是否打开?
So I am trying to simulate that the phone is receiving a call. I have successfully extracted the phones ring tone and played it. Now I want to simulate the vibration. While I can make the phone vibrate, I want to emulate the exact pattern that the phone vibrates with as when it receives a call. Is there some setting or class that I can use to extract this pattern, and also detect if vibration is turned on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你必须以某种模式振动它。
http://www.androidsnippets.org/snippets/22/
我不确定使用什么模式作为标准,您可能可以在源代码中找到它,或者自己继续尝试不同的模式,直到满意为止。
You have to vibrate it in a pattern.
http://www.androidsnippets.org/snippets/22/
I'm not sure what pattern is used as standard, you could probably find it in the source, or else keep trying different patterns yourself until it is satisfactory.
似乎没有类可以为您提供来电的“标准”振动设置。
由于大多数手机都配有自定义供应商呼叫者应用程序,并且 Google Play 上有很多自定义呼叫者应用程序,因此这种“标准”模式可能根本不存在。
AOSP 的标准来电应用程序使用此模式:
并检测是否打开振动:
这依赖于您可以在标准手机设置中找到的“响铃时振动”和“声音模式”设置。
It seems like there is no class that can provide you with 'standart' vibration settings for incoming call.
Since most phones come with custom vendor caller apps and since there are a lot of custom caller apps on Google Play, this 'standart' pattern probably doesn't even exist.
Standart caller app from AOSP uses this pattern:
And to detect if the vibration is turned on:
This relies on the "Vibrate while ringing" and "Sound mode" settings you can find in standart phone settings.
为什么不使用 Android 源代码来看看他们是如何做到的呢?
电话应用程序源代码可从
获取
https://android.googlesource.com/platform/packages/apps/Phone
Why not use the Android source in order to see how they do it?
The Phone app source is available from
https://android.googlesource.com/platform/packages/apps/Phone