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
""" | |
Finds the app links and checks if those links are hosting asset links for a package name. | |
To run this command, make sure adb server is running and there is a device attached. | |
Usage - python well_known.py [PACKAGE NAME REGEX] | |
""" | |
import sys | |
import requests | |
import subprocess | |
import re |
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
companion object { | |
private const val REQUEST_CODE_FLEXI_UPDATE = 17362 | |
} | |
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | |
super.onActivityResult(requestCode, resultCode, data) | |
if (requestCode == REQUEST_CODE_FLEXI_UPDATE) { | |
when (resultCode) { | |
Activity.RESULT_OK -> { // handle user's approval } | |
Activity.RESULT_CANCELED -> { // handle user's rejection } |
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
dependencies { | |
implementation 'com.google.android.play:core:1.6.0' | |
} |
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 Context.showToast(text: String, duration: Int = Toast.LENGTH_LONG) { | |
Toast.makeText(this, text, duration).show() | |
} | |
override fun onStateUpdate(installState: InstallState) { | |
if (installState.installStatus() == InstallStatus.DOWNLOADED) { | |
showToast("download complete", Toast.LENGTH_LONG) | |
showUpdateSnackbar() | |
} | |
} |
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
private fun checkForUpdate() { | |
appUpdateManager.appUpdateInfo.addOnSuccessListener { | |
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && | |
it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { | |
updateInfo.value = it | |
updateAvailable.value = true | |
} else { | |
updateInfo.value = null | |
updateAvailable.value = false | |
} |
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
override fun onResume() { | |
super.onResume() | |
appUpdateManager.appUpdateInfo.addOnSuccessListener { | |
if (it.installStatus() == InstallStatus.DOWNLOADED) { | |
notifyUser() | |
} | |
} | |
} |
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
class MainActivity : AppCompatActivity(), InstallStateUpdatedListener { | |
override fun onStateUpdate(installState: InstallState) { | |
if (installState.installStatus() == InstallStatus.DOWNLOADED) { | |
notifyUser() | |
} | |
} | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) |
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
override fun onResume() { | |
super.onResume() | |
appUpdateManager.appUpdateInfo.addOnSuccessListener { | |
if (it.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) { | |
appUpdateManager.startUpdateFlowForResult( | |
it, | |
AppUpdateType.IMMEDIATE, | |
this, | |
REQUEST_CODE_FLEXI_UPDATE | |
) |
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
private fun requestUpdate(appUpdateInfo: AppUpdateInfo?) { | |
appUpdateManager.startUpdateFlowForResult( | |
appUpdateInfo, | |
AppUpdateType.FLEXIBLE, // HERE specify the type of update flow you want | |
this, // the instance of an activity | |
REQUEST_CODE_FLEXIBLE_UPDATE | |
) | |
} |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var appUpdateManager: AppUpdateManager | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
appUpdateManager = AppUpdateManagerFactory.create(this) | |
NewerOlder