Jump to content
Sign in to follow this  
Rollo62

[Fmx, iOS] Vibration, which Framework for which devices ?

Recommended Posts

Dear all,

 

a CrossPost in the German DP.

 

I want to use a simple vibration-feedback, aka Peek und Pop,
but I'm unsure with which method this may run on all iPhone devices.
 

There is the possibility to use AudioServicesPlaySystemSound,
https://stackoverflow.com/questions/33425586/vibrate-iphone-6s-manually-like-peek-and-pop
which would be perfectly OK for me.

But I had to note that this doesn't seem to work on all devices anymore.

 

There is also the TapticEngine, which can be used on newer devices (I think >= iOS10 / iPhone7).
https://developer.apple.com/documentation/uikit/uiimpactfeedbackgenerator
https://www.delphipraxis.net/192200-uiimpact-feedback-generator-fehlende-klasse-deklarieren-und-nutzen.html

 

There seems to exist also a way via 3DTouch.
https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/Adopting3DTouchOniPhone/3DTouchAPIs.html

 

Which method might guarantee that it will work on all devices and versions ?

 

 

Edited by Rollo62

Share this post


Link to post

Given one of the answers in the SO link, it sounds (pun intended) like AudioServicesPlaySystemSound is your best bet to ensure it works on all devices. You just need to import the function, something like this:

 

uses
  iOSapi.CoreFoundation;

const
  libAudioToolbox = '/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox';

procedure AudioServicesPlaySystemSound(inSystemSoundID: UInt32); cdecl;
  external libAudioToolbox name _PU + 'AudioServicesPlaySystemSound';

 

Share this post


Link to post

Yes I used this one.

So you know any reasons why this might work on some iPhones and some not ? 

These were comments from users, i dont have such iPhones  in hand.

Its working fine on all my test devices. 

 

Share this post


Link to post
5 hours ago, Rollo62 said:

So you know any reasons why this might work on some iPhones and some not ? 

These were comments from users, i dont have such iPhones  in hand.

I see one comment about it not working on iOS 7.1.2, which I supposed might have had a bug? Which comments are you referring to?

Share this post


Link to post

My clients with that issue had newer phones, iPhoneX even, definitvely >= iOS 11.
Anyway, there were not too many complaints about missing vibration function, so I hope its not a general issue.
Probably the users switched it off somehow or had some other apps interfearing with vibration,
unfortunately they couldn't give me some clear explanation of the errors and configurations at the hotline.

 

I am still aware and on the hunt for more strange behaviours with my clients in the future,
but some issues like that might be solved by time automatically too (hopefully) :classic_smile:

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×