AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones de compras dentro de la aplicación
  • Special cases
  • Aplicación en segundo plano: Caso concreto de Android 10
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Sends:
  • a request for purchasing an "In-App" product associated with the application.
  • a request for purchasing a subscription.
Note: The purchase request is asynchronous. A "Callback" procedure is run when receiving the response to the purchase request.
Ejemplo
MyProduct is inAppProduct = arrProduct[nIndex]
inAppPurchaseProduct(MyProduct, ValidateProductPurchase)
PROCEDURE ValidateProductPurchase(bSuccess is boolean, Product is inAppProduct, Receipt)

IF NOT bSuccess THEN
	ToastDisplay(ErrorInfo())
	RETURN
ELSE
	// Android case
	IF InAndroidMode() THEN
		// Consume the product (optional)
		inAppConsumeProduct(Product, Receipt, ConsumeProduct)
	END
	// iOS case
	IF IniOSMode() THEN
		// Activate the product in the application
		EnableProduct(Product)
		// Save the purchase in the application preferences
		SaveParameter(Product.Identifier, 1)
	END
END
Sintaxis
iPhone/iPad

iOS: Send a purchase request Ocultar los detalles

<Result> = inAppPurchaseProduct(<Product to purchase> , <Quantity> , <WLanguage procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Product to purchase>: inAppProduct variable
Name of the inAppProduct variable corresponding to:
  • the product to purchase.
  • the subscription to purchase or to renew.
<Quantity>: Integer
Quantity to purchase.
  • For a subscription, this parameter must correspond to 1.
  • If the value of this parameter is equal to 0, <Result> is set to False and the procedure is not called.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") executed when the purchase request response is received. For more details on this procedure, see Parameters of the procedure used by inAppPurchaseProduct.
Android

Android: Send a purchase request Ocultar los detalles

<Result> = inAppPurchaseProduct(<Product to purchase> , <WLanguage procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Product to purchase>: inAppProduct variable
Name of the inAppProduct variable corresponding to:
  • the product to purchase.
  • the subscription to purchase or to renew.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") executed when the purchase request response is received. For more details on this procedure, see Parameters of the procedure used by inAppPurchaseProduct.
Observaciones

Special cases

  • If the purchase is valid, the application must supply the purchase content to the user.
  • iPhone/iPad If the purchase was performed, the application must store this information. This information can be stored in the preferences by SaveParameter.
  • If inAppPurchaseProduct is used to purchase a subscription that is already active for the user, this subscription is automatically extended for the corresponding period.
  • Android You cannot purchase a product that was already purchased by the user. The product must be consumed (with inAppConsumeProduct) before it can be purchased again.
    inAppListPurchase is used to retrieve the products purchased by the user and not consumed yet.
  • Android You cannot specify the quantity of products to purchase. You must create products corresponding to the desired quantity in the Google Play developer console. Then, the application must manage the use of the purchased quantities.
  • Android You cannot perform several requests for purchase at the same time. You must wait for the response to a request before performing a new request.
  • Android inAppPurchaseProduct has no effect if it is run from the Android simulator or emulator.
Android

Aplicación en segundo plano: Caso concreto de Android 10

A partir de Android 10, no se puede abrir una ventana si la aplicación está en segundo plano.
La función inAppPurchaseProduct puede abrir una ventana. Si se utiliza esta función cuando la aplicación está en segundo plano, se producirá un error fatal.
Consejos:
  • Para saber si la aplicación está en segundo plano, utilice la función InBackgroundMode.
  • Si una aplicación necesita interactuar con el usuario cuando está en segundo plano, se puede mostrar una notificación (con el tipo Notification). La aplicación volverá al primer plano cuando se haga clic en la notificación, si la propiedad ActivateApplication se establece en True. También es posible abrir una ventana desde el procedimiento pasado a la propiedad ActionClick.
Para obtener más información, consulte Android 10: Comportamiento de las aplicaciones en segundo plano.
Componente: wd300android.aar
Versión mínima requerida
  • Versión 19
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local