我想直接从我的应用程序中打开 google play Protect,以便用户可以轻松启用或禁用 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 );
}
});
并在清单文件中添加这一行
Intent intent = new Intent();
final String GOOGLE_PLAY_SETTINGS_COMPONENT = "com.google.android.gms";
final String GOOGLE_PLAY_SETTINGS_ACTIVITY = ".security.settings.VerifyAppsSettingsActivity";
intent.setClassName( GOOGLE_PLAY_SETTINGS_COMPONENT, GOOGLE_PLAY_SETTINGS_COMPONENT + GOOGLE_PLAY_SETTINGS_ACTIVITY);
startActivity(intent);