Delphi调用android振动功能


本文整理自网络,侵删。

 
uses
  Androidapi.JNI.App, Androidapi.JNIBridge, Androidapi.JNI.Os,
  Androidapi.Helpers;
var
  LVibrator: JVibrator;
begin
  LVibrator := TJVibrator.Wrap
    ((SharedActivity.getSystemService(TJActivity.JavaClass.VIBRATOR_SERVICE)
    as ILocalObject).GetObjectID); // 调用振动
  if not LVibrator.hasVibrator then
  begin
    ShowMessage('手机不支持震动');
    Exit;
  end;
  LVibrator.vibrate(500); // 振动500毫秒
end;

权限
在Project Options中设置Uses Permissions将Vibrate设为true

相关阅读 >>

Delphi opendialog使用方法

Delphi firemonkey 学习笔记 �c tpopup 控件的使用

Delphi 实现英汉字典的转换

Delphi antiemupeb

Delphi 如何获取桌面图标方法

汇编基础寄存器

Delphi带进度条复制文件函数

Delphi 动态内存查找法

Delphi fmx jpg 保存数据库 从数据库读取

Delphi中实现文件拷贝的三种方法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...