Appflow.ai
Visit our websitePricingSign up for freeLog in
  • GET STARTED
    • What is Appflow.ai?
    • Quickstart - How to start working with Appflow.ai?
    • FAQ
    • Ownership and other roles
  • SDK Set-up Instructions
    • Android SDK
      • Google Play Store Credentials
        • Google Service Account Key
        • Google real-time developer notifications(RTDN)
        • FCM server key(optional)(to be updated)
      • Events (Custom events)
      • Purchases
      • Visual constructor
      • User info
      • Push notifications
    • iOS SDK
      • Specify Apple Store Keys
      • Purchases and User Info
      • Event tracking (Custom events)
      • Push Notifications Configuration
      • Visual constructor
  • IN-APP PURCHASE
    • SKU adding
  • METRICS & EVENTS
    • Calculations of Analytics
    • Terms and Descriptions
    • Purchase Events
    • In-app Events
    • Events Structure
    • End-users Attributes
    • Users' statuses
  • SUBSCRIPTION ANALYTICS
    • Dashboard
    • Configurator
    • Reports
    • A/B Testing
    • Integrations
    • Create Push-notifications
    • In-app Messages
    • Return of Advertisement
    • Funnels
    • Funnel 2.0 BETA
    • Entitlements
    • Visual Constructor
  • INTEGRATIONS
    • Adjust
    • Appsflyer
    • Mixpanel
    • Webhooks
    • Apple Search Ads Attributions
    • Branch
    • Amplitude
  • OTHERS
    • Pricing plans and important information about your payments
    • Storing your data
    • Privacy Policy
    • Terms of Use
    • Unsubscribe from Appflow.ai
Powered by GitBook
On this page
  • Paywall
  • WelcomePage

Was this helpful?

  1. SDK Set-up Instructions
  2. Android SDK

Visual constructor

Test out the best Paywalls and Welcome Pages of your Android Apps with Appflow.ai Visual Constructor

PreviousPurchasesNextUser info

Last updated 1 year ago

Was this helpful?


Test out the best Paywalls and Welcome pages of your Android Apps with Appflow.ai Visual Constructor

Paywall

The SDK provides a shortcut for displaying paid products. After setting the style in Appflow.ai's , you can display it by call method:

Appflow.showPaywall(context: Context, listener: PaywallListener)

When the user clicks the back button, the paywall will automatically close, you can also actively close the following methods

Appflow.closePaywall()

Example

Appflow.showPaywall(context, object : Appflow.PaywallListener {
    override fun onPurchaseCompleted(purchase: Purchase) {
        Toast.makeText(this@MainActivity, "successful purchase ${purchase.skus}", Toast.LENGTH_SHORT).show()
    }

    override fun onClose() {}

    override fun onFail(msg: String?) {
        Toast.makeText(this@MainActivity, "show paywall fail $msg", Toast.LENGTH_LONG).show()
        // or
        // Appflow.closePaywall()
    }
})

API Reference

PaywallListener

onPurchaseCompleted(purchase: Purchase)

onPurchaseCompleted(purchase: Purchase)

onClose()

This method is called when the user closes the paywall

onFail(msg: String?)

This method will be called when the paywall loading error

WelcomePage

The SDK provides a welcome page that you can add to your application in the following ways

add in layout page

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.imp.page.welcome.WelcomeView
        android:id="@+id/welcomeView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</FrameLayout>

or dynamically add in the code

class SplashActivity : Activity() {

    private lateinit var mWelcomeView: WelcomeView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mWelcomeView = WelcomeView(this)
        setContentView(mWelcomeView)
    }
}

NOTE

WelcomePage supports timeout setting,the default timeout is 30 seconds,you can set it in the following ways:

a、 in layout page,add timeOut property

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Set the timeout to 5 seconds -->
    <com.imp.page.welcome.WelcomeView
        android:id="@+id/welcomeView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:timeOut="5"/>

</FrameLayout>

b、in the code, set by the constructor

class SplashActivity : Activity() {

    private lateinit var mWelcomeView: WelcomeView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mWelcomeView = WelcomeView(this, 5)//Set the timeout to 5 seconds
        setContentView(mWelcomeView)
    }
}

When WelcomePage displays success, failure, or timeout, it will tell you through WelcomeViewListener

WelcomeView.setListener(listener: WelcomeViewListener)

Example

class SplashActivity : AppCompatActivity() {

    private lateinit var mWelcomeView: WelcomeView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        mWelcomeView = findViewById(R.id.welcomeView)
        mWelcomeView.setListener(object : WelcomeView.WelcomeViewListener {
            override fun onShow() {
                Handler(Looper.getMainLooper()).postDelayed({ goMain() }, 2000)
            }

            override fun onFail(t: Throwable) {
                goMain()
            }
        })
    }

    private fun goMain() {
        startActivity(Intent(this@SplashActivity, MainActivity::class.java))
        finish()
    }

    override fun onBackPressed() {}
}

API Reference

WelcomeViewListener

onShow()

Success callback

onFail(t: Throwable)

Callback when fails or time out

remote constructor