Search code examples
androiddelphifiremonkey

How to open playstore and direct to my apps page


i have android application created with delphi firemonkey and i want my apps open play store and direct to my apps page when i hit some button

  unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin
//open playstore and direct to my apps page
end;

end.

Solution

  • Try this:

    Intent := TJIntent.Create;
    Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
    Intent.setData(StrToJURI('market://details?id=PACKAGE_NAME'));
    SharedActivity.startActivity(Intent);
    

    Where PACKAGE_NAME is the your app's package that you registered on the playstore. For example com.mypackage.myapp