前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >2016级移动应用开发在线测试13-Location、Sensor & Network

2016级移动应用开发在线测试13-Location、Sensor & Network

作者头像
达达前端
发布2022-04-29 08:05:42
4320
发布2022-04-29 08:05:42
举报
文章被收录于专栏:达达前端达达前端

1. 充分利用智能手机的GPS定位信息,创造了O2O的商业模式,打通了线上与线下的信息流和商流,极大地推动了移动互联网的迅猛发展,下面关于GPS技术描述错误的是() 

您的回答为:GPS需要地面基站进行辅助矫正定位信息,否则无法准确定位。 

()GPS需要地面基站进行辅助矫正定位信息,否则无法准确定位。

()24颗GPS卫星在离地面22000KM的高空上,以12小时为周期环绕地球运行,使得在任意时刻,地面的任意一点都可同时观测到4颗以上的卫星,在任何天气情况下随时获取可靠的位置信息。

()GPS综合定位的话,精度可达厘米级和毫米级。但民用领域开发的精度约为10米。

()GPS定位易受周围环境的影响,并非一下就能定位成功,因此需要在程序代码中做好各种防范措施。建议在室外空旷的地方测试GPS是否定位成功,避免在有遮挡的地方测试,在室内很有可能无法成功定位。

()GPS(Global Position Syste),即全球定位系统,是20世纪70年代由美国陆海空三军联合研制的新一代控件卫星导航定位系统。

2. Android系统提供了位置服务的API,以下对Android定位使用叙述错误的是()  

您的回答为:在获取到LocationManager对象后,不需要指定LocationManager的定位方法,就可以通过调用LocationManager.getLastKnowLocation()方法获取当前位置 

()LocationManager可以用来获取当前的位置,追踪设备的移动路线,或设定敏感区域,在进入或离开敏感区域时设备会发出特定警报。

()在获取到LocationManger对象后,不需要指定LocationManager的定位方法,就可以通过调用LocationManager.getLastKnowLocation()方法获取当前位置。

()Location是一个代表位置信息的抽象类,用它可以获取所有的位置数据,GPS定位返回的位置数据中可以获取到当前的:高度,方向,经度和速度信息。

()在定位时,需要实现一个LocationListener位置监听接口,共有四个方法:void onLocationChanged(Location location):位置改变回调方法;void onStatusChanged(String provider,int status,Bundle extras):状态改变回调方法;void onProviderEnabled(String provider):定位提供者启用回调方法;void onProviderDisabled(String provider):定位提供者停用回调方法。

()LocationProviders则是提供定位功能的组件集合,集合中的每种组件以不同的技术提供设备的当前位置,区别在于定位的精度,速度和成本等方面。LocationProvider分两种: LocationManager.GPS_PROVIDER:通过GPS定位,较为精确,但比较耗电;LccationManager.NETORK_PROVIDER):通过网络定位,对定位精度不高或省电情况可考虑使用。

3. Android平台支持的传感器类型有哪些?

您的回答为:

TYPE_ACCELEROMETER:硬件,以m/s2[Math Processing Error]为单位测量三个轴向的(x,y,和z)加速度,包括重力。用于运动检测(震动,倾角等)。┋

TYPE_AMBIENT_TEMPERATURE:硬件,以摄氏度为单位测量周围空间的温度,用于检测空气温度。┋

TYPE_GRAVITY:软件/硬件,以m/s2为单位测量三个轴向的(x,y,和z)的重力。用于运动检测(震动,倾角等)。┋

TYPE_GYROSCOPE:硬件,以rad/s为单位测量设备三个物理轴线方向(x,y,和z)的旋转速度。用于检测旋转(旋转,翻转等等)。┋

TYPE_LIGHT:硬件以lx为单位测量周围的光线级别(光照度)。 用于控制屏幕亮度。┋

TYPE_LINEAR_ACCELERATION:软件或硬件,以m/s2为单位测量三个轴向的(x,y,和z)的加速度,不包括重力。用于检测单个轴线的加速度。┋

TYPE_MAGNETIC_FIELD:硬件 以,μT为单位测量周围三个物理轴向(x, y, z)的磁场。 用于创建一个罗盘。┋

TYPE_ORIENTATION:软件,测量设备所有三个物理轴向(x,y和x)的旋转角度。当使用Level 3的API的时候,你能通过使用重力传感器和磁场传感器,结合getRotatinMatrix()方法,获取设备的倾斜矩阵和旋转矩阵。用于检测设备的位置。┋

TYPE_PRESSURE:硬件,以hPa或mbar为单位测量周围的气压。 用于检测气压的变化。┋

TYPE_PROXIMITY:硬件,以cm为单位测量一个物体相对于设备屏幕的临近程度,这种传感器的典型用例是检测是否手机被放到人的耳旁。用于检测通话过程中手机的位置。┋

TYPE_RELATIVE_HUMIDITY:硬件,以百分比(%)为单位测量周围的相对湿度。用于检测结露点,绝对和相对湿度。┋

TYPE_ROTATION_VECTOR:软件或硬件,通过提供设备的三个旋转矢量测量设备方向。 用于运动检测和旋转检测 

全选

4. Android使用传感器的必要操作有哪些?  

您的回答为:

//获取传感器管理对象

SensorManager mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

获取传感器管理器┋

//获取传感器的类型(TYPE_ACCELEROMETER:加速度传感器)

Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEOMETER);

获取传感器类型┋

//创建传感器监听器

SensorEventListener msensorEventListener = new SensorEventListener(){

//当传感器的值改变的时候回调方法

@Override

public void onSensorChanged(SensorEvent event){

}

//当传感器精度发生改变时回调该方法

@Override

public void onAccuracyChanged(Sensor sensor, int accuracy){

}

};

创建传感器监听┋

//为传感器注册监听器

mSensorManager.registerListener(msensorEventListener, mSensor, SensorManager.SENSOR_DELAY_GAME);

注册传感器监听┋

//取消监听

mSensorManager.unregisterListener(msensorEventListener);

取消传感器监听 

全选

5. Android的网络访问方法主要有两种:一种是基于Socket的网络连接;另一种是基于HTTP协议的网络连接,下面关于Android网络通讯开发叙述错误的是()  

您的回答为:

HttpURLConnection是基于HTTP协议的,其底层通过Socket实现通信。HttpURLConnection设计的非常灵活,不会因为网络超时的问题而导致程序僵死。   

()HttpURLConnection是基于HTTP协议的,其底层通过Socket实现通信。HttpURLConnection设计的非常灵活,不会因为网络超时的问题而导致程序僵死。

()HTTP(超文本传输协议)是一个基于请求响应模式的,无状态的,应用层的协议。客户端向服务器发送HTTP请求包括:请求方法,请求头和正文。

()Socket由IP地址和端口号两部分组成。IP地址用来定位设备,端口号用来定位应用程序或者进程。Socket的交互通过字节流来完成。

()Socket通信方式连接一般适用于实时要求比较高的应用,例如:聊天,即时战斗的网游等。HTTP通信方式较为普遍,服务器有较多现成的应用可以使用的应用,开发起来速度较快

()Android应用不管使用哪种方式访问网络,都需要在清单文件中添加网络访问权限,否则程序会报错,android.permission.INTERNET

6. 以下关于HttpURLConnection类重要方法描述错误的是() http://android.xsoftlab.net/reference/java/net/HttpURLConnection.html  

您的回答为:InputStream getOutputStream():获取输出流   

()String getResponseMessage():获得HTTP服务器响应的消息,返回值类型为字符串

()InputStream getOutputStream():获取输出流

()int getResponseCode():或者HTTP服务器响应的代码,放回值类型为整形,如果没有响应码,则返回-1

()InputStream getErrorStream():当出现请求的文件在远程服务器不存在等错误时,对从服务器返回的错误信息输入流进行分析,以便找出出错的原因

()void setRequestMethod(String Methond):设置传送给远程HTTP服务器的请求命令。参数method的取值可以为GET,POST,HEAD,PUT,DELETE,TRACE或OPTIONS

7. JSON是一种非常流行的轻量级的数据交换方式,RESTful服务几乎都在使用JSON格式进行数据传输,以下关于JSON格式叙述错误的是() https://baike.baidu.com/item/JSON/2462549?fr=aladdin

您的回答为:JSON是一个键值对的集合,其中“键/值”在集合中是有严格顺序要求的 

()每个“键”后跟一个冒号“:”与值隔开,每组“键/值”对之间使用逗号“,”隔开

()“键”是关键字,用字符串表示,“值”是双引号括起来的字符串,数值,true,fase,nulll,JSON对象或者数组

()数组以左中括号“【”开始,右中括号“】”结束

()JSON是一个键值对的集合,其中“键/值”在集合中是有严格顺序要求的

()一个JSON对象是以左括号“{”开始,右括号“}”结束

8. You can access sensors available on the device and acquire raw sensor data by using the Android sensor framework. The sensor framework provides several classes and interfaces that help you perform a wide variety of sensor-related tasks. Which job that you can use the sensor framework to do. 

http://android.xsoftlab.net/guide/topics/sensors/sensors_overview.html  

您的回答为:

Determine which sensors are available on a device.┋

Determine an individual sensor's capabilities, such as its maximum range, manufacturer, power requirements, and resolution.┋

Acquire raw sensor data and define the minimum rate at which you acquire sensor data.┋

Register and unregister sensor event listeners that monitor sensor changes. 

全选

9. You can access these sensors and acquire raw sensor data by using the Android sensor framework. The sensor framework is part of the android.hardware package and includes the following classes and interfaces.  http://android.xsoftlab.net/guide/topics/sensors/sensors_overview.html

您的回答为:

SensorManager:You can use this class to create an instance of the sensor service. This class provides various methods for accessing and listing sensors, registering and unregistering sensor event listeners, and acquiring orientation information. This class also provides several sensor constants that are used to report sensor accuracy, set data acquisition rates, and calibrate sensors.┋

Sensor:You can use this class to create an instance of a specific sensor. This class provides various methods that let you determine a sensor's capabilities.┋

SensorEvent:The system uses this class to create a sensor event object, which provides information about a sensor event. A sensor event object includes the following information: the raw sensor data, the type of sensor that generated the event, the accuracy of the data, and the timestamp for the event.┋

SensorEventListener:You can use this interface to create two callback methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes. 

全选

10. Android platform support which type of sensors? http://android.xsoftlab.net/guide/topics/sensors/sensors_overview.html

您的回答为:

TYPE_ACCELEROMETER: Hardware, Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity. Motion detection (shake, tilt, etc.).┋

TYPE_AMBIENT_TEMPERATURE: Hardware, Measures the ambient room temperature in degrees Celsius (°C). See note below. Monitoring air temperatures.┋

TYPE_GRAVITY: Software or Hardware, Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z). Motion detection (shake, tilt, etc.).┋

TYPE_GYROSCOPE: Hardware, Measures a device's rate of rotation in rad/s around each of the three physical axes (x, y, and z). Rotation detection (spin, turn, etc.).┋

TYPE_LIGHT: Hardware, Measures the ambient light level (illumination) in lx. Controlling screen brightness.┋

TYPE_LINEAR_ACCELERATION: Software or Hardware, Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity. Monitoring acceleration along a single axis.┋

TYPE_MAGNETIC_FIELD: Hardware, Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT. Creating a compass.┋

TYPE_ORIENTATION: Software, Measures degrees of rotation that a device makes around all three physical axes (x, y, z). As of API level 3 you can obtain the inclination matrix and rotation matrix for a device by using the gravity sensor and the geomagnetic field sensor in conjunction with the getRotationMatrix() method. Determining device position.┋

TYPE_PRESSURE: Hardware, Measures the ambient air pressure in hPa or mbar. Monitoring air pressure changes.┋

TYPE_PROXIMITY: Hardware, Measures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a person's ear. Phone position during a call.┋

TYPE_RELATIVE_HUMIDITY:Hardware, Measures the relative ambient humidity in percent (%). Monitoring dewpoint, absolute, and relative humidity.┋

TYPE_ROTATION_VECTOR:Software or Hardware, Measures the orientation of a device by providing the three elements of the device's rotation vector. Motion detection and rotation detection. 

全选

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-01-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档