Created
November 23, 2015 16:03
-
-
Save tiwiz/9d6561f54fac3035ee8e to your computer and use it in GitHub Desktop.
Draw over other apps on Android 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClick(View v) { | |
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, | |
Uri.parse(String.format("package:%s", getPackageName()))); | |
startActivityForResult(intent, DRAW_OVER_OTHER_APPS); | |
} | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
if (requestCode == DRAW_OVER_OTHER_APPS) { | |
if (Settings.canDrawOverlays(this)) { | |
//Freely draw over other apps | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment