How to add the custom button on google's(device) native application in android?

天大地大妈咪最大 提交于 2019-12-11 02:49:39

问题


I want to add one button on google(device)'s native application Like(Google Map),Using this button I want to open my application.

I have do some work regarding that.

  • Using AccessibilityService I find the which application still running using this service I open the stand alone dialog using SYSTEM_ALERT_WINDOW permission. But the dialog cover whole screen , I manage to display this dialog in screen bottom side, but still I can't do anything in device native application like (google map), because my dialog is contain those touch, I checked the activity stack using terminal ,I found that still my application is top of the stack.

Now After two day (Saturday/Sunday) research I can't find the any suitable solution regarding this.

I'm stuck.


回答1:


As per my understanding, you want to show a UI on top of google application but once your UI is evoked you are not able to send the touch to the google application over which you evoked your UI which is very obvious as focus is now on your UI. I'll suggest you to use a Service and bind your UI to it and use WindowManager.LayoutParams with appropriate flags. You can follow this link

https://github.com/henrychuangtw/Android-ChatHead/blob/master/app/src/main/java/henrychuang/tw/chatheadmsg/ChatHeadService.java

to get an idea how to do it. Instead of chathead UI you have to use your UI.



来源:https://stackoverflow.com/questions/45273620/how-to-add-the-custom-button-on-googlesdevice-native-application-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!