eli*_*eve 6 application-development ubuntu-touch
我正在玩我的第一个 Ubuntu Touch 应用程序,并试图启用手机的内部“振动器”。我该怎么做呢?
任何有关如何在 C++、JavaScript 或 Go 中执行此操作的指针都将受到高度赞赏。
该网站说你可以通过对 cordova(html5 抽象层)的 API 调用来完成此操作,因此它必须是https://developer.ubuntu.com/api/html5/sdk-14.04/org.apache 中公开的 api。科尔多瓦振动/
小智 0
它是触觉反馈模块,因此使用:
Project "Vibrator"
// Code by VictarionMagne
//if used in openstore remember to mark apropriotly
//ye i camt spell
import QtQuick 2.5
import QtQuick.Controls 2.0
import QtFeedback 5.0
Item {
property bool isOn:true
HapticsEffect{
id:rumble
attackIntensity:1.0
attackTime:500
intensity:5.0
duration:1000
fadeTime:1000
fadeIntensity:1.0
}
id: rootItem
anchors.fill: parent
Rectangle{
id:hh
color:"red"
width:600
height:600
visible:true
Button{
height:100
width:100
id:big
text:"1 wave"
x:0
y:0
onClicked:{
if (isOn==true){
rumble.start();}
else rumble.stop();
}
Button{
x:200
width:100
height:100
text:"toggle"
onClicked:{
if(isOn == true){
isOn= false
rumble.stop();
rumble.duration =10
}
else isOn=true
rumble.duration = 100000
}
}
}
}
Run Code Online (Sandbox Code Playgroud)