Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

accelerometer - question on shake with 2017-3068 build
Started by yvandotet Apr 06 2017 12:44 PM

2 replies to this topic

Best Answer Rob Miracle , 06 April 2017 - 02:36 PM

Well the vibration may be enough to trigger additional accelerometer events.

 

Rob

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

yvandotet

[GLOBAL: userInfoPane.html]
yvandotet
  • Contributor

  • 174 posts
  • Corona SDK

Hello,

I am with huawei y6, and this code below do nothing on the device but return a response on simulator

local function listener( event )

  if event.isShake then
    print(1)
    system.vibrate()
  end
     
  return true
end
Runtime:addEventListener( "accelerometer", listener )

But this code always work on my device (always return something, even when my phone is just on my table without moving). Is this a bug ?

local function listener( event )
  system.vibrate()
  if event.isShake then
    print(1)
  end
  return true
end
Runtime:addEventListener( "accelerometer", listener )

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,838 posts
  • Corona Staff

  Best Answer

Well the vibration may be enough to trigger additional accelerometer events.

 

Rob



[TOPIC: post.html]
#3

yvandotet

[GLOBAL: userInfoPane.html]
yvandotet
  • Contributor

  • 174 posts
  • Corona SDK

true lol, thx




[topic_controls]
[/topic_controls]