Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Spotify über Intent (https://www.delphipraxis.net/216437-spotify-ueber-intent.html)

DaCoda 28. Dez 2024 21:41

Spotify über Intent
 
Hallo,
ich versuche die Spotify-App zu steuern aus meiner App.

Ich versuchte das so: (AText = https://open.spotify.com/intl-de/tra...PnpWanMEo:play)

Code:
procedure TfrmMain.SendTextViaIntent(const AText: string);
var
  Intent: JIntent;
begin
  Intent := TJIntent.Create;
  Intent.setType(StringToJString('text/pas'));
  Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
  Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringtoJString(AText));
  if MainActivity.getPackageManager.queryIntentActivities(Intent, TJPackageManager.JavaClass.MATCH_DEFAULT_ONLY).size > 0 then
    MainActivity.startActivity(Intent)
  else
    ShowMessage('Receiver not found');
end;
Aber ich bekomme Receiver not found.

Hat da jemand Erfahrung, oder Tip ?

DANKE!

Olli73 28. Dez 2024 23:26

AW: Spotify über Intent
 
Geht sowas in der Art (URI anstatt URL)?

aText := spotify:track:4FZmjzFP31JGVPnpWanMEo:play

DaCoda 29. Dez 2024 00:42

AW: Spotify über Intent
 
So es ist schon mal gelöst.

Ich habe es nun so gemacht:
Code:
procedure TfrmMain.SendTextViaIntent(const AText: string);
var
  Intent: JIntent;
begin
  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
  Intent.setData(StrToJURI(AText));
  SharedActivity.startActivity(Intent);
end;
Vielen Dank Euch :-)

DaCoda 29. Dez 2024 14:37

AW: Spotify über Intent
 
Hallo, wenn Spotify gestartet wird, dann ist meine App im Hintergrund.

Wie bekomme ich meine App automatisch wieder nach TOP ?


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz