2

I want to open google play protect directly from my app so that user can enable or disable play protect easily.

Image just for refrence

enter image description here

Neha Sharma
  • 449
  • 5
  • 13
  • https://stackoverflow.com/questions/47564468/how-to-open-and-check-whether-play-protect-is-enabled-or-disabled – Anand Dec 01 '18 at 12:02

3 Answers3

2
    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);
Neha Sharma
  • 449
  • 5
  • 13
1

Button 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 );
        }
    });

And Add this line in manifest file

1
   Intent i = new Intent();
    i.setClassName("com.google.android.gms", "com.google.android.gms.security.settings.VerifyAppsSettingsActivity" );
    try {
        startActivity(i);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(getApplicationContext(), "Activity Not Found", Toast.LENGTH_LONG).show();
    }