본문 바로가기

Programming/Android

[Android] Google Play Store로 이동시키기

Google Play Store로 이동시키기

  • 앱 리뷰 남기기 위한 유도 팝업(MaterialDialog 사용)

  • app/build.grade
 
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile('com.github.afollestad.material-dialogs:commons:0.8.5.5@aar') {
        transitive = true
    }
  ...
} 


  • Source
 

public void goPlayStore(String content, String positiveText, String negativeText) {

        new MaterialDialog.Builder(ReviewActivity.this).content(content).positiveText(positiveText).neutralText(negativeText).onPositive(new MaterialDialog.SingleButtonCallback() {
            @Override
            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                String appPackageName = getPackageName();
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
                } catch (android.content.ActivityNotFoundException anfe) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
                }
            }
        }).show();
    }






참고 : https://stackoverflow.com/questions/11753000/how-to-open-the-google-play-store-directly-from-my-android-application