Can android wear access a content provider from the mobile device?

痴心易碎 提交于 2019-12-13 08:59:04

问题


Since android wear and mobile are two separate devices, is the wear device able to access a public content provider from a custom app that's on the mobile once it is connected? Thanks.

edit: if you downvote, pls comment why, as your downvotes don't help me understand anything.

edit2: Ok, let me explain a little more. I'm creating a watch face that displays some useful data along with the time and to do that I need to access a content provider from my watch face. Can I access a content provider from an app thats on my phone through my android wear? So far my testing has been unsuccessful in trying to access a content provider directly through getContentResolver().

I could use dataApi to send info to the wear device, but that would require the app also be running on the phone right? So question still remains, How would I retrieve content provider information from an app?


回答1:


On the watch, you do not have direct access to the providers from the companion phone. The wearable support library provides access to the Calendar Provider and that is the only one that I can remember is available on the watch directly; for the rest, you need to go through the data layer APIs and have a phone component to retrieve the data and send it to or sync it across the watches.



来源:https://stackoverflow.com/questions/33071370/can-android-wear-access-a-content-provider-from-the-mobile-device

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