首页 > 解决方案 > 如何以编程方式在android中打开谷歌播放保护?

问题描述

我想直接从我的应用程序中打开 google play Protect,以便用户可以轻松启用或禁用 Play Protect。

图片仅供参考

在此处输入图像描述

标签: androidgoogle-playgoogle-play-protect

解决方案


按钮 btn_play_protectSetting = findViewById(R.id.btn_play_protectSetting);

    btn_play_protectSetting.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent openPlayStoreProtectSetting  = new Intent();
            final String GOOGLE_PLAY_SETTINGS_COMPONENT = "com.google.android.gms";
            final String GOOGLE_PLAY_SETTINGS_ACTIVITY = ".security.settings.VerifyAppsSettingsActivity";
            openPlayStoreProtectSetting .setClassName( GOOGLE_PLAY_SETTINGS_COMPONENT, GOOGLE_PLAY_SETTINGS_COMPONENT + GOOGLE_PLAY_SETTINGS_ACTIVITY);
            startActivity(openPlayStoreProtectSetting );
        }
    });

并在清单文件中添加这一行


推荐阅读