---
# System prepended metadata

title: '**Open another app**'

---

# **Open another app**

# android

## intent
https://ithelp.ithome.com.tw/articles/10157880 
```java=
Intent intent = getPackageManager().getLaunchIntentForPackage("com.adobe.reader");
startActivity(intent);
```

[[Android] How to open PDF Viewer from my app?](https://faq.pdfviewer.io/en/articles/4634469-android-how-to-open-pdf-viewer-from-my-app )

[show-pdf-using-intent-in-android](https://www.geeksforgeeks.org/show-pdf-using-intent-in-android/)

* ### explicit intent: launch specific app

* ### implicit intent: set type and let user choose app to launch



>建立intent => startActivity(intent)


## FileProvider
get file uri

https://developer.android.com/reference/android/support/v4/content/FileProvider.html#ServeUri 

## *SendBroadcast*
receive from Broadcast


----

# IOS

## URL Schemes 

> ms-excel:ofe|u|https://pgcconline.blackboard.com/webapps/dur-browserCheck-bb_bb60/samples/sample.xlsx

## example of opening excel file


[issue-deep-linking-to-ms-excel-from-ios-app](https://stackoverflow.com/questions/49266569/issue-deep-linking-to-ms-excel-from-ios-app )
```objectivec=
@objc static func openExcel() {
        //replace the below url with yours. may be this one dosen't work
        let originalString = "ofe|u|https://pgcconline.blackboard.com/webapps/dur-browserCheck-bb_bb60/samples/sample.xlsx" 
        let encodedString = originalString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
        let encodedURLString = "ms-excel:" + encodedString!

        if let url = URL(string: encodedURLString),
            UIApplication.shared.canOpenURL(url) {
            UIApplication.shared.openURL(url)
        } else if let itunesUrl = NSURL(string: "https://itunes.apple.com/us/app/microsoft-excel/id586683407?mt=8&uo=4"), UIApplication.shared.canOpenURL(itunesUrl as URL) {
            UIApplication.shared.openURL(itunesUrl as URL)
        }
    }

```

[ref: opening-an-ios-app-via-url](https://brainwashinc.com/2021/02/24/opening-an-ios-app-via-url/)
 

----

