惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 【当耐特】
博客园 - 聂微东
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
F
Full Disclosure
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
D
DataBreaches.Net
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Cyberwarzone
Cyberwarzone
S
Schneier on Security
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
云风的 BLOG
云风的 BLOG
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
罗磊的独立博客
L
LangChain Blog
L
Lohrmann on Cybersecurity
The GitHub Blog
The GitHub Blog
P
Palo Alto Networks Blog
The Cloudflare Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
S
Securelist
NISL@THU
NISL@THU
L
LINUX DO - 最新话题
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News | PayPal Newsroom
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
V
V2EX

博客园 - 邢帅杰

.net core使用SharpZipLib压缩zip文件并设置密码 CSRedisCore用法 Android 常用数据目录(内部 / 外部、缓存、文件) 的 获取方法对照表 安卓把assets中的文件copy到app目录中 oracle执行sql语句前清除缓存 安卓开发使用interface自定义回调函数 安装DockerDesktop并启用 oracle中decode用法 vue使用import.meta编译报错,import.meta.env报:类型“ImportMeta”上不存在属性“env”。必须配置module。 oracle游标使用详解 oracle存储过程中声明一个行变量,接收游标中的行数据。variable_name table_name%ROWTYPE oracle NVL和NVL2 C#获取文件md5码 oracle查询存储过程和函数中是否包含某个字符串 Android清除WebView缓存 C#获取当前日期是星期几 切换项目git地址,项目迁移到新git地址 C#线程同步、跨进程同步Mutex详解、C#只允许运行一个实例 Android Stack说明 安卓如何唤醒深度睡眠的设备并执行任务 java两个日期相差秒数
安卓打开第三方app并传入参数
邢帅杰 · 2025-06-10 · via 博客园 - 邢帅杰

一、通过包名启动
如果你不知道那个APP的Activity,但是知道包名(package name),那么可以使用如下的方法:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);
二、通过package/activity启动
如果APP之间有合作关系,可以获得合作APP的清单文件(manifest),那么可以从该文件中获知package/activity,可使用如下的方法来启动该APP特定活动界面:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
三、传递参数
如果要在启动APP时传递参数,可以在意图(Intent)中设置:
intent.putExtra("firstKeyName","FirstKeyValue");
intent.putExtra("secondKeyName","SecondKeyValue");

代码封装

    /**
     * 打开第三方app并传入参数
     * */
    public static void StartThirdAPKHaveExtra(String apkName, HashMap<String,String> param) throws Exception {
        final Intent intent = getPackageManager().getLaunchIntentForPackage(apkName);
        if (intent == null) {
            throw new Exception("无法启动应用【" + apkName + "】:包名无效");
        }
        intent.setAction("android.intent.action.VIEW");
        if (param != null && param.size() > 0) {
            for (String key : param.keySet()) {
                intent.putExtra(key, param.get(key));
            }
        }
        startActivity(intent);
    }