在Android Wear直接上网吗? [英] Direct internet connection on Android Wear?

查看:144
本文介绍了在Android Wear直接上网吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个应用程序,显示从互联网上一些照片。

I tried to build an app showing some pictures from the internet.

我使用的功能,这对我的电话的伟大工程(银河S3 - 安卓4.3),但对手表,我收到了 java.io.EOFException 的异常

I used a function, which works great on my Phone (Galaxy S3 - Android 4.3) but on the watch i get a java.io.EOFException exception.

在code(在手机的工作原理):

The code (works on phone):

private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
    ImageView bmImage;

    public DownloadImageTask(ImageView bmImage) {
        this.bmImage = bmImage;
    }

    protected Bitmap doInBackground(String... urls) {
        String urldisplay = urls[0];
        Bitmap mIcon11 = null;
        try {
            InputStream in = new java.net.URL(urldisplay).openStream();
            mIcon11 = BitmapFactory.decodeStream(in);
        } catch (Exception e) {
            //Log.e("Error", e.getMessage());
            e.printStackTrace();
        }
        return mIcon11;
    }

    protected void onPostExecute(Bitmap result) {
        bmImage.setImageBitmap(result);
    }
}

其他功能抛出一个 org.apache.http.NoHtt presponseException 手表配对和网上,我可以使用语音命令和搜索网络等。

Other functions throw a org.apache.http.NoHttpResponseException The watch is paired and online as i can use voice commands and search the web etc.

因此​​,问题:我能直接从Android Wear访问网络还是需要处理我的手机上所有的这些工作?或者是有什么毛病我的设置?

So the question: Can i access the web directly from Android Wear or do need to handle all these tasks on my phone? Or is there something wrong with my setup?

推荐答案

Android Wear设备无法直接访问互联网。如果您要访问的网页,你应该这样做,用你的同伴的应用程序。您可以使用数据层API 的耐磨和数据之间来回传输掌上电脑。数据层API内置了支持转移资产(主要是图像,但基本上您传输任何其他二进制数据)。

Android Wear Devices have no direct access to the internet. If you want to access the web, you should do so using your companion app. You can use the Data Layer API to transfer data back and forth between the wearable and the handheld. The Data Layer API has built-in support for transferring assets (mostly images, but basically you transfer anything other binary data).

这篇关于在Android Wear直接上网吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆