You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在RAD Studio Delphi安卓应用中通过简单Intent启动其他安卓应用

安卓通过Intent启动其他应用的简单示例问题

我找不到用Intent在安卓系统上启动其他应用的简单示例。查看过SendIntent和ReceiveIntent的示例应用,但它们都比我需要的复杂得多。我尝试了一些基于安卓官方示例的代码,但不确定是权限问题还是其他原因导致无法正常工作。最近我了解到,有时候需要手动编辑AndroidManifest.template.xml文件。

我首先把示例代码里的ACTION_VIEW改成了CATEGORY_LAUNCHER,但应用始终提示“Receiver not found”,这说明代码根本找不到我要启动的应用包。

我的代码如下:

procedure TForm1.SendTextViaIntent(const AText: string);
var
  Intent: JIntent;
begin
  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.CATEGORY_LAUNCHER);

  if MainActivity.getPackageManager.queryIntentActivities(Intent, TJPackageManager.JavaClass.MATCH_ALL).size > 0 then
    MainActivity.startActivity(Intent)
  else
    ShowMessage('Receiver not found');
end;

内容的提问来源于stack exchange,提问作者Andre Van Zuydam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 08:12:02