Delphi Mobile Phone Vibrate IOS Android

Source: Internet
Author: User

Delphi Mobile Phone Vibrate IOS Android

Delphi Mobile Phone Vibration IOS Android Vibration

Https://community.embarcadero.com/blogs/entry/how-to-vibrate-ios-and-android-phones-using-firemonkey-and-xe8

http://blogs.embarcadero.com/davidi/2015/07/06/43894/

iOS methods

#import <AudioToolbox/AudioToolbox.h>
Calling methods
Systemsoundid Soundid;
Ksystemsoundid_vibrate is a constant $FFF

audioservicesplaysystemsound (ksystemsoundid_vibrate);

Delphi method

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 unitUmain;interfaceuses  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,  FMX.Controls.Presentation, FMX.StdCtrls{$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;ProcedureAudioServicesPlaySystemSound( inSystemSoundID: integer); Cdecl; External libAudioToolbox Name _PU + ‘AudioServicesPlaySystemSound‘;{$ENDIF}type  TForm1 = class(TForm)    Button1: TButton;    procedureButton1Click(Sender: TObject);  private    { Déclarations privées }  public    { Déclarations publiques }  end;var  Form1: TForm1;implementation{$R *.fmx} procedureTForm1.Button1Click(Sender: TObject);{$IFDEF ANDROID}Var  Vibrator:JVibrator;{$ENDIF}begin{$IFDEF ANDROID}  Vibrator:=TJVibrator.Wrap((SharedActivityContext.getSystemService(TJContext.JavaClass.VIBRATOR_SERVICE) asILocalObject).GetObjectID);  // Vibrate for 500 milliseconds  Vibrator.vibrate(500);{$ENDIF}{$IFDEF IOS}  AudioServicesPlaySystemSound( kSystemSoundID_vibrate );{$ENDIF}end;end.

Add Library method  

iOS must Add Path

RAD ide>tools>options>sdk Manager>ios System SDK

Click on the right button >add a new path item.

Path on remote machine:$ (sdkroot)/system/library/frameworks

File Mask: Audiotoolbox

Path Type: Other Path

Include subdirectories:

Point ok>update Local File Cache

The Windows System PC can see the updated Audiotoolbox feature file.

D:\Users\Administrator\Documents\Embarcadero\Studio\SDKs\iPhoneOS9.1.sdk\System\Library\Frameworks\ Audiotoolbox.framework\headers

Reference

http://blog.csdn.net/tht2009/article/details/50183721

Error

[DCC Error] E2597 ld:warning:directory not found for option
'-fe:\users\administrator\documents\embarcadero\studio\sdks\iphoneos9.3.sdk\system\library\privateframeworks '
Ld:file not found:/system/library/frameworks/audiotoolbox.framework/audiotoolbox

Workaround:

1, received the establishment directory Privateframeworks

2. Remove Windows directory E:\USERS\ADMINISTRATOR\DOCUMENTS\EMBARCADERO\STUDIO\SDKS\IPHONEOS9.3.SDK.

Then close the IDE and remove the IDE's 3 SDKs. Then re-download, download the IOS32 bit, add the Audiotoolbox library, update the cache, and then update the 64-bit.

Delphi Mobile Phone Vibrate IOS Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.