点击登录

讨论 Band 9 从互联网 (http) 加载图像的简单应用程序

  • 主题发起人 主题发起人 yaiko
  • 开始时间 开始时间

yaiko

Lv.0
社区会员

我正在尝试使用本机框架开发一个基本应用程序:https://iot.mi.com/vela/quickapp/

一切都运行良好,应用程序可以加载到我的智能手环中,但是当我尝试使用需要互联网连接的功能时似乎不起作用,我试图从互联网上获取 <image/> 但它没有加载,我也尝试使用 @system.fetch 从 https API 加载数据,但都不起作用。
(尽管它只在模拟器 IDE 中有效)

有人知道如何做到这一点吗?
或者是否有其他方法可以将图像从 Android 设备下载并移动到应用程序资产?我只是试图从互联网上渲染图像。

我对这个框架很陌生,希望有人能帮助我,谢谢!
(我使用了谷歌翻译,对不起我的中文)


---
Hi
I'm trying to develop a basic app with the native framework: https://iot.mi.com/vela/quickapp/

Everything worked well and the app loads in my smart band, however when I try to use functions that require internet connection seems to not work, I'm trying to fetch an <image/> from internet but it doesn't load, I also tried loading data from a https API with @system.fetch but doesn't work neither.
(Despite it works only in the emulator IDE)

Is there somebody that knows how to make this work?
Or if also there is an alternative to download and move the image from the Android device to the app assets?, I'm simply trying to render an image from internet.

I'm new with this framework, hope somebody can help me out, thanks!
(I used google translator, sorry for my chinnese)
 
The main problem is band9 doesn't support @system.fetch, so you can't use it, and access internet on your band directly (such as load online image).

As for system.interconnect, it is an API that allows a band and an Android app to communicate in a socket-like communication, and Band 9 supports it. This means you need to develop a dedicated Android app for transmitting images. When your band needs to load an online image, it should send a request to your Android app via interconnect. The Android app will then download the required online image, encode it into something like Base64, and transmit it back to your band. Once the band receives it, it needs to decode and save the image before displaying it. This is merely a feasible idea—everything needs to be implemented by yourself, and there are no official examples available.
 
The main problem is band9 doesn't support @system.fetch, so you can't use it, and access internet on your band directly (such as load online image).

As for system.interconnect, it is an API that allows a band and an Android app to communicate in a socket-like communication, and Band 9 supports it. This means you need to develop a dedicated Android app for transmitting images. When your band needs to load an online image, it should send a request to your Android app via interconnect. The Android app will then download the required online image, encode it into something like Base64, and transmit it back to your band. Once the band receives it, it needs to decode and save the image before displaying it. This is merely a feasible idea—everything needs to be implemented by yourself, and there are no official examples available.
I understand that, but according to their protocol the interconnection in the app is done via their Wearable SDK (They have an official example in the last link of the docs) which supposedly works together with the Wearable App but it doesn't interconnect for me.

I tried this app that does something similar to what I'm trying to do and it also requires the Wearable app for the interconnection but for some reason it can't interconnect neither 🙁
 
The main problem is band9 doesn't support @system.fetch, so you can't use it, and access internet on your band directly (such as load online image).

As for system.interconnect, it is an API that allows a band and an Android app to communicate in a socket-like communication, and Band 9 supports it. This means you need to develop a dedicated Android app for transmitting images. When your band needs to load an online image, it should send a request to your Android app via interconnect. The Android app will then download the required online image, encode it into something like Base64, and transmit it back to your band. Once the band receives it, it needs to decode and save the image before displaying it. This is merely a feasible idea—everything needs to be implemented by yourself, and there are no official examples available.
我在小米手环9 Pro 使用com.xiaomi.xms.wearable.demo.debug.1.0.0.rpk 可以在手机XMS Wearable Demo上收到
JSON:
{
        name: 'Amy',
        age: 18,
        t: Date.now()
 }
但是却无法通过app向手环发送消息
代码:
conn = interconnect.instance()

// conn.listen()
conn.getReadyState({})
getReadyState方法根本没响应,是不是哪里有问题?
 
I understand that, but according to their protocol the interconnection in the app is done via their Wearable SDK (They have an official example in the last link of the docs) which supposedly works together with the Wearable App but it doesn't interconnect for me.

I tried this app that does something similar to what I'm trying to do and it also requires the Wearable app for the interconnection but for some reason it can't interconnect neither 🙁
This page show the sample of interconnect:

If you build the apk and rpk success with jks;
By the step:
可以尝试先使用运动健康连接手环,然后打开安卓手机端同步器,最后打开手环端软件,期间手环不能息屏,同步器不能进入后台程序
  • Open com.mi.health app to connect band.
  • Open com.searchstars.hyperbilibili application
  • Then open com.searchstars.hyperbilibili app in band .

You can see a QRCode in band and com.searchstars.hyperbilibili application.
Screenshot android app,Then Open tv.danmaku.bili app ,scan the image to login.
 

*这是一则由 Google AdSense 自动推荐的广告,与本站无关,不对其真实性与可靠性负责

相似主题

Home 首页
Home 资源
News 发现
Account 我的
顶部