79491434

Date: 2025-03-07 06:34:25
Score: 0.5
Natty:
Report link
private fun getInstalledUPIApps(context: Context): List<String> {
    val upiList = mutableListOf<String>()
    kotlin.runCatching {
       val upiUriIntent = Intent().apply {
          data = String.format("%s://%s", "upi", "pay").toUri()
       }
       val packageManager = context.packageManager
       val resolveInfoList =
          packageManager?.queryIntentActivities(
             upiUriIntent,
             PackageManager.MATCH_DEFAULT_ONLY
          )
       if (resolveInfoList != null) {
          for (resolveInfo in resolveInfoList) {
             upiList.add(resolveInfo.activityInfo.packageName)
          }
       }
    }.getOrElse {
       it.printStackTrace()
    }
    Log.i(TAG, "Installed UPI Apps: $upiList")
    return upiList
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Avinash Kumar