在 DalvikVM 上运行地理定位
我知道可以在 Android 上使用 dalvikvm 运行简单的(例如 HelloWorld)java 程序。我想启动一个简单的地理定位应用程序,但是 Context 是什么?我变得只是上下文没有发现异常。这是否意味着 jars 没有上下文,什么是用 dalvikvm 启动的?存在一些可能性,可以在 dalvikvm 上运行 LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
之类的东西,并且通常可以运行一些标准的 android 功能(例如 Internet 或 SMS)达尔维克虚拟机?
I know that is possible to run a simple(f.e. HelloWorld) java programms with dalvikvm on Android. I want to start a simple Geolocation App, but what is with Context? I became just Context don´t found Exception. Does it means that there are no Context for jars, what are started with dalvikvm? Exist some possibilities to run something like LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
on dalvikvm and is it generally possible to run some of the standard android function (like Internet or SMS) with dalvikvm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您提到的,您可以从终端运行一个简单的 java 程序。但是,您无法运行这样的 Android 应用程序。不过,您可以使用 am 命令从终端发送意图,该命令可用于启动活动/服务/广播接收器。
因此,实现您想要的功能的一种可能方法是开发一个简单的 Android 服务并将其安装在您的手机上,然后使用
am startservice
启动它。Like you mentioned, you can run a simple java program from a terminal. However, you can't run an Android application like that. You can however send an intent from the terminal using the
am
command, which you can use to start an activity/service/broadcast receiver.So one possible way to do what you want would be to develop a simple android service and install it on your phone, and then start it using
am startservice <intent>
.