简体   繁体   中英

Sony SmartWatch - How to pass data to control extension?

If I would like to pass some data (via bundle or something else) to my control extension with CONTROL_START_REQUEST_INTENT action, what I can do?

I don't see any Intent or Bundle object being passed to the constructor of ControlExtension class.

Unfortunately, there is currently no way to know if the ControlExtension was started by the user from the watch, or if you requested a start yourself via the START_REQUEST intent. The resulting start sent from the host application does not provide such information.

You could solve it by setting a flag when you send the START_REQUEST intent, and then you will know (to a certain extent, not 100% of course) that the extension was started via a request and not by the user. It is a work around, but as I said, not waterproof.

Can you give me an example of what you would like to accomplish?

Couldn't you use the preferences for this?

Prior to using the START_REQUEST, put a value in the preferences that the extension is started on a request, and from the extension code just check for the existence of that value.

However, IMO you should rethink your app logic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM