Open theunreal opened 8 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); }
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