Created
June 12, 2020 11:55
-
-
Save Pierry/1216211b2151afc1b2b9d543e5740baf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun openLink(){ | |
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://saudedigital.page.link/app")) | |
startActivity(browserIntent) | |
} | |
fun startSaudeDigital() { | |
val packageName = "br.com.gds.saudedigital" | |
packageManager.getLaunchIntentForPackage(packageName)?.let { intent -> | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | |
startActivity(intent) | |
} ?: openGooglePlay(packageName) | |
} | |
fun openGooglePlay(packageName: String) { | |
intent = Intent(Intent.ACTION_VIEW) | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | |
intent.data = Uri.parse("market://details?id=$packageName") | |
startActivity(intent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment