1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram

  5. Delphifan Magazine
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

How to Vibrate Android or Iphone

Discussion in 'Delphi Android And IOS' started by medreis, Nov 6, 2015.

  1. medreis
    Offline

    medreis DF Junior

    Uses 

    {$IFDEF ANDROID}
      ,Androidapi.JNI.Os,
      Androidapi.JNI.GraphicsContentViewText,
      Androidapi.Helpers,
      Androidapi.JNIBridge
    {$ENDIF}
    {$IFDEF IOS}
      ,IOSapi.MediaPlayer,
      IOSapi.CoreGraphics,
      FMX.Platform,
      FMX.Platform.IOS,
      IOSapi.UIKit,
      Macapi.ObjCRuntime,
      Macapi.ObjectiveC,
      iOSapi.Cocoatypes,
      Macapi.CoreFoundation,
      iOSapi.Foundation,
      iOSapi.CoreImage,
      iOSapi.QuartzCore,
      iOSapi.CoreData
    {$ENDIF}
      ;

    {$IFDEF IOS}
    Const
      libAudioToolbox        = '/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox';
      kSystemSoundID_vibrate = $FFF;

    Procedure AudioServicesPlaySystemSound( inSystemSoundID: integer ); Cdecl; External libAudioToolbox Name _PU + 'AudioServicesPlaySystemSound';
    {$ENDIF}



    //In your Application

    procedure TForm1.Button1Click(Sender: TObject);
    {$IFDEF ANDROID}
    Var
      Vibrator:JVibrator;
    {$ENDIF}
    begin
    {$IFDEF ANDROID}
      Vibrator:=TJVibrator.Wrap((SharedActivityContext.getSystemService(TJContext.JavaClass.VIBRATOR_SERVICE) as ILocalObject).GetObjectID);
      // Vibrate for 500 milliseconds
      Vibrator.vibrate(500);
    {$ENDIF}
    {$IFDEF IOS}
      AudioServicesPlaySystemSound( kSystemSoundID_vibrate );
    {$ENDIF}
    end;
     
     
    Mahdi likes this.

Share This Page