Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

system.vibrate() not working on android even though vibrate permission is enabled
Started by bluedeskstudios Feb 18 2018 09:18 AM

2 replies to this topic
[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

bluedeskstudios

[GLOBAL: userInfoPane.html]
bluedeskstudios
  • Observer

  • 15 posts
  • Corona SDK

	android =
	{
		usesPermissions =
		{
			"android.permission.INTERNET",
			"android.permission.VIBRATE",
		},
	},

My issue is that whenever I try to run system.vibrate() in my scene code, I get an error message saying that it requires the security permission, even though I already have the permission enabled in my build.settings, as seen above. Any idea what the fix is? I am running Corona 2018.3223 on windows 10. My android phone is running Android 7.0

 

The error says java.lang.SecurityException: Requires VIBRATE permission



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,561 posts
  • Enterprise

Android 7 introduced on-demand permissions.  I don't know if vibrate is one you have to explicitly ask for or not.

 

Look at our sample apps in Corona/SampleCode/Media/Camera to see how we ask for permissions to access the camera and see if you need to do the same thing for vibrate.

 

Rob



[TOPIC: post.html]
#3

bluedeskstudios

[GLOBAL: userInfoPane.html]
bluedeskstudios
  • Observer

  • 15 posts
  • Corona SDK

The only problem is that system.vibrate was working back when I was running Corona.2017.3189, however, now that I am running Corona 2018.3223, the system. vibrate is not working properly. I did check the sample code, and this is what it reads. 

	android =
	{
		usesPermissions =
		{
			"android.permission.CAMERA",
			"android.permission.WRITE_EXTERNAL_STORAGE",
		},
		usesFeatures =
		{
			{ name = "android.hardware.camera", required = true },
			{ name = "android.hardware.camera.front", required = false },
		},
	},

Is this an issue with my Android phone or with Corona?




[topic_controls]
[/topic_controls]