7

Currently i am using below code for asking overlay permission

if (!isSystemAlertPermissionGranted(context)) {
          /* if not construct intent to request permission */
            Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                    Uri.parse("package:" + BuildConfig.APPLICATION_ID));
                /* request permission via start activity for result */
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
            return false;
        }

But I seen that some app like Facebook messenger can draw over other app without asking overlay permission. Now m curious about this how they can do that. any lead is helpful for me!!!

Lokesh
  • 3,247
  • 2
  • 33
  • 62
  • 1
    because since marshmallow the apps getting downloaded via playstore are automatically granted SYSTEM_ALERT_WINDOW which is used to draw over other apps. – Gautam Mar 10 '18 at 13:04

1 Answers1

0

Just as Gautam in the comments said, that is only available for apps that are targetting marshmallow and above and downloaded via Playstore

You have to ask the user to activate the permission in the app setting if you are planning on deploying your app somewhere else other than the Playstore

In any case, this feature will be terminated in a future update Android 10 is going to have a new implementation to the "Bubbles" feature that the Facebook messenger has

Leo Jebran
  • 154
  • 8