Vibrator

Vibrator

by Spiral Code Studio

View and activate on the Corona Store

The Vibrator plugin provides you a fine control over vibration ability of Android devices. iOS devices, unfortunately, lack such customization.

Documentation

Thanks! Great work!

Hello, I added the plugin in my build.settings and tried to require it just like in the tutorial, but I’m getting module ‘plugin_vibrator’ not found. What could be the problem? 

--in build.settings settings = { plugins = { ['plugin.vibrator'] = {publisherId = 'com.spiralcodestudio'} } --in main.lua local vibrator = require('plugin.vibrator')

Hello,

I activated the vibrator plugin some month ago. Now I changed the Corona SDK version to 2016.2830 and the Corona Simulator don’t find the plugin.

I tried to buy another time but the plugin is not downloaded when my app run on Simulator.

Other plugin are in folder: C:\Users\MyUser\AppData\Roaming\Corona Labs\Corona Simulator\Plugins.

How I can download the plugin or make it clear to Corona that must download it?

Thanks

Ben

I’m not sure the vibrator plugin works in the simulator. Are you getting any messages in your console log?
 

Rob

yes, I have the following error message and the app don’t start:

21:45:07.404

21:45:07.404 Windows simulator build date: Feb 18 2016 @ 02:28:53

21:45:07.404

21:45:10.662

21:45:10.662 Copyright © 2009-2016 C o r o n a L a b s I n c .

21:45:10.662 Version: 3.0.0

21:45:10.662 Build: 2016.2830

21:45:10.662 Platform: GT-I9300 / x64 / 6.3 / Intel® HD Graphics 4600 / 4.2.0 - Build 10.18.10.3540 / 2016.2830 / it_IT | IT | it_IT | it

21:45:10.678 Loading project from: C:\Users\Raul\Documents\Corona Projects\Cells-mania

21:45:10.678 Project sandbox folder: C:\Users\Raul\AppData\Local\Corona Labs\Corona Simulator\Sandbox\cells-mania-DBD20F576FEECC7F5D6B0B4309372EC2\Documents

21:45:11.693 PluginSync: plugin com.coronalabs/plugin.coronaAds needs to be updated for platform win32-sim to build number: 2828

21:45:11.693 PluginSync: downloading plugin: http://plugins.coronasphere.com/com.coronalabs/plugin.coronaAds/2016.2828/win32-sim/plugin.coronaAds.zip

21:45:11.693 PluginSync: plugin com.coronalabs/plugin.fuse needs to be updated for platform win32-sim to build number: 2828

21:45:11.693 PluginSync: downloading plugin: http://plugins.coronasphere.com/com.coronalabs/plugin.fuse/2016.2828/win32-sim/plugin.fuse.zip

21:45:12.240 ERROR: Runtime error

21:45:12.240 module ‘plugin_vibrator’ not found:

21:45:12.240 no field package.preload[‘plugin_vibrator’]

21:45:12.240 no file ‘C:\Users\Raul\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin_vibrator.lua’

21:45:12.240 no file ‘C:\Users\Raul\Documents\Corona Projects\Cells-mania\plugin_vibrator.lua’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\Resources\plugin_vibrator.lua’

21:45:12.240 no file ‘.\plugin_vibrator.lua’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\lua\plugin_vibrator.lua’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\lua\plugin_vibrator\init.lua’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\plugin_vibrator.lua’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\plugin_vibrator\init.lua’

21:45:12.240 no file ‘C:\Users\Raul\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin_vibrator.dll’

21:45:12.240 no file ‘.\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\Resources\plugin_vibrator.dll’

21:45:12.240 no file ‘.\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\loadall.dll’

21:45:12.240 no file ‘C:\Users\Raul\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin_vibrator.dll’

21:45:12.240 no file ‘.\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\Resources\plugin_vibrator.dll’

21:45:12.240 no file ‘.\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\plugin_vibrator.dll’

21:45:12.240 no file ‘C:\Program Files (x86)\Corona Labs\Corona SDK\loadall.dll’

21:45:12.240 stack traceback:

21:45:12.240 [C]: in function ‘error’

21:45:12.240 ?: in function ‘gotoScene’

21:45:12.240 C:\Users\Raul\Documents\Corona Projects\Cells-mania\main.lua:25: in main chunk

With previous version of Corona Simulator, when I run the app, the plugin is downloaded in folder: 'C:\Users\Raul\AppData\Roaming\Corona Labs\Corona Simulator\Plugins.

Now only the plugin coronaads and fuse are downloaded.

If I insert into this folder the plugin (saved before install new Corona version) I obtain another error message:

21:52:34.913

21:52:34.913 Copyright © 2009-2016 C o r o n a L a b s I n c .

21:52:34.913 Version: 3.0.0

21:52:34.913 Build: 2016.2830

21:52:34.913 Platform: GT-I9300 / x64 / 6.3 / Intel® HD Graphics 4600 / 4.2.0 - Build 10.18.10.3540 / 2016.2830 / it_IT | IT | it_IT | it

21:52:34.913 Loading project from: C:\Users\Raul\Documents\Corona Projects\Cells-mania

21:52:34.913 Project sandbox folder: C:\Users\Raul\AppData\Local\Corona Labs\Corona Simulator\Sandbox\cells-mania-DBD20F576FEECC7F5D6B0B4309372EC2\Documents

21:52:51.339 WARNING: The ‘plugin.vibrator’ library is not available on this platform.

21:52:51.339 WARNING: The ‘plugin.vibrator’ library is not available on this platform.

21:52:51.339 WARNING: The ‘plugin.vibrator’ library is not available on this platform.

21:52:51.355 WARNING: The ‘plugin.vibrator’ library is not available on this platform.

21:52:51.355 WARNING: The ‘plugin.vibrator’ library is not available on this Platform.

In Windows 8.1 the vibrator function: hasVibrator() return false (don’t work) but with previous version of Corona, when I build the apk for Android the plugin is correctly insert into apk file and the app installed on smartphone works correctly.

Now, with new Corona version also on smartphone the app don’t start. I obtain en error message similar the first one.

How I can solve this issue?

Thanks

Ben

What files are  located in C:\Users\Raul\AppData\Roaming\Corona Labs\Corona Simulator\Plugins?

Rob

In folder there are the followings files:

catalog.json

plugin.coronaAds.zip

plugin.fuse.zip

plugin_coronaads.lua

plugin_fuse.lua

The catalog.json contains:

{“com.coronalabs/plugin.coronaAds”:{“submitDate”:1461645688,“md5”:“b44e671ad8ff1dcbe8c40208ce244259”,“publishDate”:1461645688,“url”:“http://plugins.coronasphere.com/com.coronalabs/plugin.coronaAds/2016.2828/win32-sim/plugin.coronaAds.zip",“filename”:“plugin.coronaAds.zip”,“size”:479},“Version”:2,“com.coronalabs/plugin.google.play.services”:"",“com.coronalabs/plugin.fuse”:{“submitDate”:1456515846,“md5”:“d81f7887587ae2e5a9a32496f7331f0d”,“publishDate”:1456515846,“url”:“http://plugins.coronasphere.com/com.coronalabs/plugin.fuse/2016.2828/win32-sim/plugin.fuse.zip”,“filename”:“plugin.fuse.zip”,“size”:470},“CoronaBuild”:"2016.2830”}

Ben

Can you post your whole build.settings file? Please use the blue <> in the edit bar to help keep your code formatted.

Rob

The build.settings file:

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", supported = { "portrait", 'portraitUpsideDown' } }, -- Android permissions android = { versionCode = "10", usesPermissions = { "android.permission.VIBRATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.ACCESS\_NETWORK\_STATE", "com.google.android.providers.gsf.permissions.READ\_GSERVICES" }, }, -- Screen supported android = { supportsScreens = { smallScreens = true, normalScreens = true, largeScreens = true, xlargeScreens = false, }, }, -- Minimum Android version (10 = 2.3.3) android = { minSdkVersion = "10", }, -- Plugins plugins = { ['plugin.vibrator'] = {publisherId = 'com.spiralcodestudio'} }, plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, }

Ben

You have to plugin tables in there. The second one overwrites the first one. Try changing it to:

-- Plugins plugins = { ['plugin.vibrator'] = { publisherId = 'com.spiralcodestudio' }, ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, },

Great, now works, when the app run on Simulator the vibrator plugin is downloaded.

The apk file is correctly created.

Thanks for your help!!!

In simulator console, I have, now the following error:

WARNING: The ‘plugin.coronaads’ library is not available on this Platform.

when is executed the command line:

coronaAds.init( “dec4b41c-…-my correct-apikey”, adListener )

It is normal?

The coronaAds plugin works in Simulator in Windows 8.1?

Ben

Most plugins do not work in the simulator since we don’t have SDK’s for OS X and Windows from most providers, so we issue a message letting you know that you need to test on device for those things to work.

Rob

OK thank you again for your invaluable help, I hope not to disturb more.

Ben

That’s what we are here for!

The plugin now supports Apple’s Taptic Engine! You can use the same API as on Android or gain the direct access to the Taptic Engine using vibrator.newHaptic().

See the docs and updated sample app.

That’s great! Until now I’ve no used this plugin for iOS.

But how do I recognize the iPhone 7 versions? Currently I’m using lines like this:

local on\_iPhone5 = ( string.find( system.getInfo("architectureInfo"), "iPhone5" ) ~= nil ) local on\_iPhone5s = ( string.find( system.getInfo("architectureInfo"), "iPhone6" ) ~= nil ) local on\_iPhone6 = ( string.find( system.getInfo("architectureInfo"), "iPhone7,2" ) ~= nil )

Do you know what the strings are for iPhone 7 / Plus?

In fact do you know of a place where all the iOS devices are listed? 

runewinse, you can find architectureInfo for example here
https://www.theiphonewiki.com/wiki/Models

iPhone 7 / Plus would correspond to values from iPhone9,1 to iPhone9,4.

ok, thanks!

Unfortunately I have some problems using the latest vibrator plugin. Or I  think it is the vibrator plugin. The texttospeech plugins seems to be lurking cose to the error also. 

When trying to build the app on a mac I get a:

BUILD ERROR: There was a problem linking the app.

                    

Examining the console window I see these lines:

duplicate symbol \_OBJC\_METACLASS\_$\_Utils in: /Users/Air/Google Drive/PROGRAMMING/CORONA/Karate Squid/iOS/Karate Squid.app/.build/plugin.texttospeech/libplugin\_texttospeech.a(Utils.o) /Users/Air/Google Drive/PROGRAMMING/CORONA/Karate Squid/iOS/Karate Squid.app/.build/plugin.vibrator/libplugin\_vibrator.a(Utils.o) ld: 15 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)\</result\> okt. 26 11:25:23.168 ERROR: Builder failed: clang: warning: libstdc++ is deprecated; move to libc++ okt. 26 11:25:23.168 duplicate symbol \_OBJC\_IVAR\_$\_Scheme.\_LuaTypeByteArray in: /Users/Air/Google Drive/PROGRAMMING/CORONA/Karate Squid/iOS/Karate Squid.app/.build/plugin.texttospeech/libplugin\_texttospeech.a(LuaUtils.o) /Users/Air/Google Drive/PROGRAMMING/CORONA/Karate Squid/iOS/Karate Squid.app/.build/plugin.vibrator/libplugin\_vibrator.a(LuaUtils.o)

Not sure what to make out of this, though…