如何在Android emulator上模拟速度?
有没有办法在Android emulator上模拟速度 [编辑] 本文的目的是测试getSpeed()方法 示例:如何在Android emulator上模拟速度?,android,android-emulator,Android,Android Emulator,有没有办法在Android emulator上模拟速度 [编辑] 本文的目的是测试getSpeed()方法 示例: 我想将设备设置为每小时20英里。可以。如果您使用Eclipse开发应用程序,则必须转到DDMS透视图。在那里,您应该可以找到一个名为Emulator control的窗口。在此窗口中,您可以向模拟器或设备发送新的地理位置(GPS坐标)。当您想要提高速度时,最好使用GPX或KML文件。在此文件中,您可以定义GPS坐标,然后逐步读取这些坐标。通过适当地选择此坐标,您可以模拟恒定速度。我
我想将设备设置为每小时20英里。可以。如果您使用Eclipse开发应用程序,则必须转到DDMS透视图。在那里,您应该可以找到一个名为Emulator control的窗口。在此窗口中,您可以向模拟器或设备发送新的地理位置(GPS坐标)。当您想要提高速度时,最好使用GPX或KML文件。在此文件中,您可以定义GPS坐标,然后逐步读取这些坐标。通过适当地选择此坐标,您可以模拟恒定速度。我的高配置pc have
3i 4GB也遇到了同样的问题,但模拟器的工作速度太慢了
我发现了一些对我有用的东西,希望它能对其他人有用。我很乐意在这里分享
我刚刚在现有的AVD
中添加了设备ram大小
,并将大小设置为1000MB
(因为我有足够的内存分配给mind 4GB)
不,我的AVD
的速度是我的终极希望,它可以帮助你 位置对象具有设置设备速度的方法:
//the instance
Location location;
//retrieves the speed of the device
location.getSpeed()
// set the speed of the device of course for testing purporses, remember to
// remove this when deploying your appplication
location.setSpeed((float) 20.0)
如果要模拟一段时间内的速度变化,可以设置计时器并在该时间范围内降低或提高速度,例如:
int secondsDelayed = 5;
new Handler().postDelayed(new Runnable() {
public void run() {
location.setSpeed((float) 50.0);
}
}, secondsDelayed * 1000);
这将在5秒内将速度提高到50 km/p你能指定“模拟速度”吗?我说的速度是指设备的运动速率。我正打算这么说。这样做,CoryEmulator速度不会影响location.getSpeed()。所以这不是正确的答案。