韌館-LearnHouse

Archive for 9 5 月, 2024

[Android]透過am start並加入參數啟動特定app

由於需要反覆啟動某隻app做一些事情後再關閉,如果用程式來啟動寫法如下,但這樣就會是建構在自己寫的app之上

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.xxxx.com/watch/81721411"));
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.setPackage("com.xxxx.yyyy");
startActivity(intent);

Read more...

2024年5 月 posted by admin in 程式&軟體 and have No Comments