pyricau / pyricau.github.com

p-y.wtf static website
https://p-y.wtf
30 stars 40 forks source link

ChatHeads no longer working on API 23 #24

Open theunreal opened 8 years ago

theunreal commented 8 years ago

https://github.com/pyricau/pyricau.github.com/blob/master/_posts/2013-04-14-chatheads-basics.markdown

Using <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> is depraced and this permission need to be granted manually by the user

ashanajackol commented 7 years ago

ya that's true but when add run time check permissions this code will work as charm :) add these lines to your code,

if(Build.VERSION.SDK_INT >= 23) { if (!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); startActivityForResult(intent, 1234); } else { Intent intent = new Intent(PassengerPickupActivity.this, OverlayService.class); startService(intent); } } else { Intent intent = new Intent(PassengerPickupActivity.this, OverlayService.class); startService(intent); }