0

How I can make a small icon to stay in screen to toggle and untoggle the application so it can be used and accessed easily when opening other apps?

Same thing like facebook messenger icon which appears with draggable tab like this:

enter image description here

TheUnreal
  • 23,434
  • 46
  • 157
  • 277
  • Cool @marmor, Thanks! But got an error in this line: `windowManager.addView(chatHead, params);` for unknown reason `Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@8448098 -- permission denied for this window type – TheUnreal Oct 05 '16 at 17:20
  • That's a pretty broad question unless you have attempted it and ran into a specific problem that we might be able to help you with. – Charles McKelvey Oct 05 '16 at 17:20
  • @TheUnreal you need to enable a special permission to support this line, you need to ask for permission: SYSTEM_ALERT_WINDOW. also, if you're on Marshmallow+ device, go to phone settings > apps > gear icon (on top) > draw over other apps > enable your app. (BTW, it should be enabled by default when installing from Google Play). – marmor Oct 05 '16 at 17:54
  • thanks @marmor! I found out after asking, I'm still stuck in it. This permission were disabled in my phone and my app keep crashing. I don't want users to experience my app the same experience I had because of this permission! If user will install my app from the Google Play the option will be enabled by default? Are you sure? because If not I will prefer to downgrade to API 22.. I don't want people to start manually allowing permissions on their phone for an app – TheUnreal Oct 05 '16 at 18:00
  • yes, the permission is on by default when installing from Google Play as long as you request that permission in your manifest. You can test this by uploading to the beta channel, and install from Play. You can also check if you have the permission before trying to put your view. – marmor Oct 05 '16 at 18:04
  • Cool thanks for this critical information! – TheUnreal Oct 05 '16 at 18:10

0 Answers0