The phone handles complex interactions; the glasses provide immediate feedback. Track connection, plugin runtime, and business-task states separately to report accurate results after disconnection, backgrounding, and restart.
Use the phone for long input, settings, file selection, and result management unsuitable for the glasses. Show the current application, device, and task states before presenting actionable primary controls.
Page area
Recommended practice
Verification
Equipment and application status
Show disconnected, plugin-starting, and business-running states separately. One green indicator must not imply that everything succeeded.
Disconnect Bluetooth, stop the GMP, and cancel a business task separately. Check that the messages distinguish these cases.
Settings and saving
Organize fields by user goal. Explain where settings are saved and when they apply to the glasses.
Preserve unsubmitted input if saving fails. Confirm synchronization from actual replies.
Files and authorization
Explain the purpose first, then let the user initiate selection or authorization. Explain the impact of denial.
After canceling file selection or denying authorization, users must be able to return to the page without repeated prompts.
Long-running tasks
Show the object and processing stage, with stop or cancel actions that are actually supported.
Leave and return to the page while awaiting a reply, upload, or processing. Check whether the result can be queried again.
Failure and recovery
Keep usable content and emphasize one primary recovery action, such as reconnecting or querying status.
Button behavior must match its label. Retrying must not repeat uncertain side effects.
connected from gm.device.getInfo(), plus subscribed connection events.
When disconnected, explain that the user must connect the glasses in the App. A Bluetooth connection does not confirm completion of a business operation.
Web runtime
gm.ready(), gm.runtime.getLifecycleState() and runtime.lifecycleChanged.
Stop unnecessary work when the host suspends. Reinitialize after runtime recreation.
Your business task
Confirmation comes from your business protocol or server. The SDK does not define your application's task states.
Show waiting, running, completed, failed, canceled, or result-unconfirmed states separately.
gm.plugin.sendMessage() returns sent, channel and payloadBytes, indicating that the message has been sent to the transmission path. It does not generate business completion confirmation for your custom GMP. Display Control Lab registers a pending request before sending it, then completes that request using requestId and statusCode in the glasses reply.
Change “Processing” to “Complete” only after receiving a matching business result.
Register pending requests before sending so a fast reply cannot arrive before its handler is ready.
Match results by protocol, operation type, requestId, and status. After timeout, query the actual state before deciding to retry.
Validate message channel, length, protocol version, and field ranges before changing business state. Copy borrowed C callback data if you need it later.
Use correlatable request IDs for commands and results. Start waiting before sending so fast replies have a receiver.
Disable an in-progress action or coalesce settings for the same target on repeated clicks. Implement deduplication for side-effecting operations; do not assume the SDK guarantees exactly-once business execution.
Bound pending queues for real-time updates. Ordinary state may retain only the latest value; handle stop, exit, and acknowledgment messages separately.
Message channels must be declared in the manifest's device.messaging scope.channels. Platform display or event channels also require the corresponding permissions.
Use clearly named Web elements such as button and label. Label forms, preserve keyboard focus, and show loading state.
Do not rely only on color, sound, or an icon for success and failure. Text and actions must mean the same thing on phone and glasses.
Allow room for translation expansion and translate complete sentences. Format dates, numbers, and units for the user's language.
GMP reads language tags through host->locale_get and maintains its own translations. Web can follow the example i18n directory. Do not assume the SDK translates business text automatically.
Verify icons, images, and Emoji with the actual fonts and display path. Users must be able to identify key results from text or state.