【发布时间】:2016-08-31 20:48:33
【问题描述】:
地狱,我正在尝试测试 Delphi 10 Android 后台服务,我正在尝试使用本地服务在后台录制声音,但是,当该服务开始将声音录制到 Test.caf 时,我的代码:
应用程序
procedure TForm1.Button1Click(Sender: TObject);
begin
TLocalServiceConnection.StartService('RecService');
服务代码:
function TAndroidServiceDM.AndroidServiceStartCommand(const Sender: TObject;
const Intent: JIntent; Flags, StartId: Integer): Integer;
begin
Result := TJService.JavaClass.START_STICKY;
FMicrophone := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
{ and attempt to record to 'test.caf' file }
FMicrophone.FileName := '/sdcard/1/test.caf';
FMicrophone.StartCapture;
sleep(5000);
FMicrophone.StopCapture;
任何帮助都非常感谢。
【问题讨论】:
标签: android service firemonkey delphi-xe