Android Wear Launcher

I am wondering how Android Wear launchers such as Swipify and Wear Mini Launcher capture touch events on the Android wear home screen. .

I tried adding the onTouch and onClick app to the Watch View Stub in my application, but I cannot figure out how to get the touches that happen outside of my application.

+6
source share
1 answer

In fact, views are directly added to the WindowManager in the Service . You can take a look at this topic to understand how it works: Creating a system overlay window (always on top)

Be careful, currently the problem in the Moto 360 system is explained here: https://plus.google.com/u/0/113671876130843889747/posts/9bqUcdgZnNb You will need to use the WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR flag to avoid the lower space. By the way, you can also take a look at the code I gave in this post to understand how overlay works. Direct link: https://github.com/PomepuyN/WatchviewStubIssue

+5
source

Source: https://habr.com/ru/post/975842/


All Articles