一些Android应用生成通知时,该设备的体积变化,部分锁定卷。对于我的生活,我不能找出如何这样做了。请,有人可以帮我提供一个例子吗?
Some Android apps generate a notification when the device's volume changes and some lock the volume. For the life of me, I cannot find out how that's done. Please, can someone help me by providing an example?
有没有广播事件检测量的变化,但也许你可以每隔一两秒钟检查音量是什么 getStreamVolume
,如果你需要在一个特定的音量锁定,每隔一两秒钟的使用: setStreamVolume
There is no Broadcast Action to detect volume changes, but you could maybe every second or two check what the volume is with getStreamVolume
and if you need to lock it at a specific volume, every second or two use: setStreamVolume
检查 http://developer.android.com/reference/android/media /AudioManager.htm 获取更多的信息。
您可以使用AlarmManager类或处理程序来检查卷每秒左右。
You could use the AlarmManager class or a handler to check the volume every second or so.
如果它是一个活动,您可以覆盖的onkeydown
来检测键presses。请参见 http://developer.android.com/reference/android/view/View。 HTML
If it's an activity, you can override onKeyDown
to detect key presses. See http://developer.android.com/reference/android/view/View.html
上一篇:System.UnauthorizedAccessException的中的Mscorwks.dll导致应用程序池崩溃应用程序、UnauthorizedAccessException、System、dl
下一篇:对身份验证应用程序引擎从Android应用程序与联合登录(OpenID的)应用程序、身份验证、引擎、OpenID