Skip to content

onRecommendation()

Methodcom.tryyoursize:tryyoursize-android

Calls handler now (once known) and on every change: signing in, a new body, a simulation finishing. Keep the subscription; cancel() it when done. Main thread.

@JvmOverloads
public fun onRecommendation(
product: String,
onError: ((TryYourSizeException) -> Unit)? = null,
handler: (Recommendation) -> Unit,
): TysSubscription
productStringRequired

Your product ID or SKU.

onError((TryYourSizeException) -> Unit)?Optional= null

Called when our window cannot be reached or the app is not registered.

handler(Recommendation) -> UnitRequired

Called now (once known) and on every change.

A subscription; cancel() it when done.

val sub = tys.onRecommendation("SKU-123") { rec ->
if (rec.status == Recommendation.Status.READY && !touched) selected = rec.size
}
// sub.cancel() in onDestroy

Was this page helpful?