Android : How to close connection with Application Tethering in Android

on Saturday, September 6, 2014


Using Delphi XE6


I have these codes:



procedure TMainForm.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
var
FService : IFMXVirtualKeyboardService;
begin
if Key = vkHardwareBack then
begin
TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(FService));
if TVirtualKeyBoardState.Visible in FService.GetVirtualKeyBoardState then
begin
FService.HideVirtualKeyboard;
end else
begin
if TabControl1.ActiveTab = TabItem2 then
begin
TabControl1.ActiveTab := TabItem1;
Key := 0;
end else
begin
Self.Hide;
MainActivity.Finish;
Application.MainForm.DisposeOf;
Key := 0;
end;
end;
end;
end;

procedure TMainForm.ConnectButtonClick(Sender: TObject);
begin
TetheringManager1.Enabled:=True;
TetheringAppProfile1.Enabled:=True;
TetheringManager1.AutoConnect(3000);
end;


With hardware back button android app closes/opens okay when TetheringManager and TetheringAppProfiler is not enabled and not connected. But when connected then android app is not closing correctly and not opening correctly (I see only black screen, but next time app opens okay). Is there any way how I can disconnect tethering?


0 comments:

Post a Comment