我有两个应用程序。 我想要在我的第一个应用程序按钮点击时打开第二个应用程序。 第二个应用程序具有所需的自定义模式,用于深度链接。 现在我想知道在我的第一个应用程序按钮点击时需要执行什么代码才能打开第二个应用程序?
我有两个应用程序。 我想要在我的第一个应用程序按钮点击时打开第二个应用程序。 第二个应用程序具有所需的自定义模式,用于深度链接。 现在我想知道在我的第一个应用程序按钮点击时需要执行什么代码才能打开第二个应用程序?
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.company.App1</string>
<key>CFBundleURLSchemes</key>
<array>
<string>CompanyApp2</string>
</array>
</dict>
</array>
这是您需要在App1的info.plist文件中添加的代码。
<key>LSApplicationQueriesSchemes</key>
<array>
<string>CompanyApp2</string>
</array>
然后您将像这样从App1启动App2:
let app2Url: URL = URL(string: "CompanyApp2://")!
if UIApplication.shared.canOpenURL(app2Url) {
UIApplication.shared.openURL(app2Url)
}
尝试下面的代码
let appURL: URL = URL(string: "CustomUrlScheme://")!
if UIApplication.shared.canOpenURL(appURL) {
UIApplication.shared.openURL(appURL)
}
In android, we can perform in the below ways
//Dial a phone
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:0377778888"));
startActivity(callIntent);
//View a map
// Map point based on address
Uri location = Uri.parse("geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+California");
// Or map point based on latitude/longitude
// Uri location = Uri.parse("geo:37.422219,-122.08364?z=14"); // z param is zoom level
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);
//View a webpage
Uri webpage = Uri.parse("http://www.android.com");
Intent webIntent = new Intent(Intent.ACTION_VIEW, webpage);
startActivity(webIntent);