How to start #️⃣

Depending on your app, it’s likely that developers are part of your app’s user base. You can recommend them to Localazy and earn money back with our partnership program. Just send them to our website with your partner code in the query parameters ?ref=<a href="/register">Sign in to get your affiliate link</a>.

Example #️⃣

You can implement your own solution, but below is a simple one from us to show a dialog to developers only after they open the app a few times. You can easily extend it and start earning money with Localazy for like 3 minutes of your work.

// Localazy.kt
package com.my.app

import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.provider.Settings
import androidx.core.content.ContextCompat.startActivity
import com.my.app.R

object Localazy {

    private const val PREFERENCES_NAME = "localazy"
    private const val PREFERENCE_START_COUNTER = "start_counter"
    private const val PREFERENCE_DISMISSED = "dismissed"
    private const val REFERRAL_URL = "https://localazy.com/android?ref=[your-referral-code]"
    private const val FIRST_SHOW = 3

    private fun Context.isDevModeEnabled(): Boolean {
        // Supported on API 17+
        return Settings.Secure.getInt(contentResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0
    }

    private fun SharedPreferences.increment(key: String): Int {
        val currentValue = getInt(key, 0) + 1
        edit().putInt(key, currentValue).apply()
        return currentValue
    }

    private fun Context.setDismissed() {
        getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE)
            .edit().putBoolean(PREFERENCE_DISMISSED, true).apply()
    }

    private fun Context.resetCounter() {
        getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE)
            .edit().putInt(PREFERENCE_START_COUNTER, 0).apply()
    }

    private fun Context.showDialog() {
        AlertDialog.Builder(this)
            .setTitle(R.string.localazy_dialog_title)
            .setMessage(R.string.localazy_dialog_text)
            .setPositiveButton(R.string.localazy_dialog_go) { dialog, _ ->
                startActivity(this, Intent(Intent.ACTION_VIEW, Uri.parse(REFERRAL_URL)), null)
                setDismissed()
                dialog.dismiss()
            }
            .setNeutralButton(R.string.localazy_dialog_no) { dialog, _ ->
                setDismissed()
                dialog.dismiss()
            }
            .setOnCancelListener { _ ->
                resetCounter()
            }
            .setOnDismissListener { _ ->
                resetCounter()
            }
            .show()
    }

    fun showReferralDialog(context: Context) {
        if (context.isDevModeEnabled()) {
            context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE).let { sp ->
                if (
                    sp.increment(PREFERENCE_START_COUNTER) >= FIRST_SHOW &&
                    !sp.getBoolean(PREFERENCE_DISMISSED, false)
                ) {
                    context.showDialog()
                }
            }
        }
    }

}

Add a few texts to your strings.xml:

<string name="localazy_dialog_title">Hello, fellow developer!</string>
<string name="localazy_dialog_text">Translating your app to more languages? Try Localazy!</string>
<string name="localazy_dialog_go">I\'m In!</string>
<string name="localazy_dialog_no">Not Interested</string>

In your main activity, just call the function with the activity context:

override fun onStart() {
    super.onStart()
    Localazy.showReferralDialog(this)
}

Which links should you use? #️⃣

You can send users to any page on our site. For Android developers, the homepage https://localazy.com or the page dedicated to Android https://localazy.com/android are likely to be the best ones.

Do not forget to add your partner code with ?ref=<a href="/register">Sign in to get your affiliate link</a>.

Stats #️⃣

You can see your stats on our partnership page available here:

Terms & Conditions #️⃣

By participating, you agree to the Localazy Affiliate Terms & Conditions.