1
0

More than 3 years have passed since last update.

[Android] レビューダイアログ表示

Last updated at Posted at 2020-04-14

レビューダイアログ表示

以下の手順となります。

・ライブラリ導入して使う
・ダイアログ表示タイミングコンフィグレーションする

ライブラリ導入

*1.dependencies に追加する *


implementation 'com.vorlonsoft:androidrate:1.2.5-SNAPSHOT'

sshot_1.png

2. Gradle Syncしてライブラリを入れる
sshot_2.png

ライブラリ使う

1. 表示したいクラスでインポートする


import com.vorlonsoft.android.rate.*

sshot_3.png

2. レビューダイアロ作成する


AppRate.with(this)

3. ダイアログ出るタイミングをコンフィグレーションする

下の設定なら、この条件になります。

アプリインストールした後、5回起動し20日以上時にダイアログが出る。
「また今度」ボタン押した後、5回起動し20日以上時にダイアログが出る。
「レビューしない」または「レビューする」押した後、ダイアログが出ない。


.setStoreType(StoreType.GOOGLEPLAY)
.setTimeToWait(Time.DAY, 10)
.setLaunchTimes(3)
.setRemindTimeToWait(Time.DAY,20)
.setRemindLaunchesNumber(5)
.setSelectedAppLaunches(1)
.setShowLaterButton(true)
.setVersionCodeCheck(false)
.setVersionNameCheck(false)
.setDebug(false)
.setCancelable(false)
.setTitle(R.string.new_rate_dialog_title)
.setTextLater(R.string.new_rate_dialog_later)
.setMessage(R.string.new_rate_dialog_message)
.setTextNever(R.string.new_rate_dialog_never)
.setTextRateNow(R.string.new_rate_dialog_ok)
.monitor() 

sshot_4.png

4. ダイアログのボタンクリックイベント追加

AppRate.with(this).setOnClickButtonListener(object: OnClickButtonListener {
            override fun onClickButton(which:Byte) {

                if(which.toString().equals(RATE)) {
                    //inApp_レビューする
                } else if(which.toString().equals(RATE_LATER)) {

                } else if(which.toString().equals(RATE_NEVER)) {
                    //nApp_レビューしない
                }
            }
        })

sshot_5.png

5. コンフィグレーションした設定と合わせる時に表示するため


        if (AppRate.with(this).getStoreType() == StoreType.GOOGLEPLAY) { // Checks that current app store type from library options is StoreType.GOOGLEPLAY
            if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING) { // Checks that Google Play is available
                AppRate.showRateDialogIfMeetsConditions(this) // Shows the Rate Dialog when conditions are met
            }
        } else {
            AppRate.showRateDialogIfMeetsConditions(this)    // Shows the Rate Dialog when conditions are met
        }

sshot_6.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0