Jump to content
GreatDayDan

tetherprofile ResourceReceived OK on Android v5 device but not on Android v7 device

Recommended Posts

 

 

I have an android app that works fine on an Android v5 but not on v7 or v9.

On the V5 device, the ProfileResourceReceived is triggered but not on the v7 or v9 device.

What changed?

Is there a fix?

 

Delphi CE 10.3.2

 

The mobile app asks for the database: This works on all versions.

procedure TfrmMMMP.Get_Database;
begin
 TabControl1.ActiveTab := tbtmhome;
  tetprof.SendString(tetMan.RemoteProfiles[FRemProfIndex], 'Get_Database', 'Get_Database');
end;

The Server gets the db and streams it to the app: This is a VCL app. It catches the request from all versions.

procedure TfrmMMMPServer.thrprofServerResourceReceived(const Sender: TObject;
  const AResource: TRemoteResource);
var
  ms: TMemoryStream;
  fs: TFilestream;
  LStream : TMemoryStream;
begin
  if (AResource.Hint <> '') and (AResource.Hint <> 'ClientLog')  then
    ToTheLog('> AResource.Hint: ', AResource.Hint);
  if AResource.Hint = 'Get_Database' then
  begin
    if Connected then
    begin
      ms := tmemorystream.Create;
      ms := dmMMMPServerVCL.GetDbAsStream;
      ms.Position := 0;
      thrprofServer.SendStream(thrmanServer.RemoteProfiles.First,
              'Here_TheDB', ms);
    end

The app catches the Response and populates a ListBox:  This does not trigger on Ver 7 or Ver 9.

procedure TfrmMMMP.tetProfResourceReceived(const Sender: TObject;
  const AResource: TRemoteResource);
begin
  if AResource.Hint = 'Here_TheDB' then
  begin
    DoStreamTheDb(AResource);
    DoFillLB(lbxRecipeNames);
    tabcontrol1.ActiveTab := TbtmRecipes;
  end

 

Edited by GreatDayDan
Added source code snippets.

Share this post


Link to post

If you're using Bluetooth for tethering, it's more than likely due to needing to request permissions for location at runtime, as Bluetooth discovery requires one of them:

 

https://developer.android.com/guide/topics/connectivity/bluetooth#Permissions

 

There's an example of how to do this in this demo:

 

https://github.com/Embarcadero/RADStudio10.3Demos/tree/master/Object Pascal/Multi-Device Samples/Device Sensors and Services/Bluetooth/BLEScanner

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

×