寻找:Android 指南针 API

发布于 2024-11-06 09:08:31 字数 336 浏览 3 评论 0原文

我正在使用 flash 为 Samsung Galaxy 编写应用程序。我想访问数字罗盘,但无法使用 Actionscript。 :(

所以我想知道:是否可以使用 android api 来检查数字罗盘并将数据写入 XML 文件?此 API 应该在 flash 应用程序运行时在后台运行前面...

你知道有什么API可以做到这一点吗? 或者一些可以轻松修改以这种方式工作的 API?

不幸的是,我对 Java 编程或 Android 编程了解不多。

感谢您的所有提示或想法... 克劳迪娅.

I'm programming an application for the Samsung Galaxy, using flash. I'd like to access the digital compass, but I can't with Actionscript. :(

So I was wondering: Is it possible to use an android api that checks the digital compass and writes the data to an XML-file? This API should run in the background while the flash-application is in front. …

Do you know any API that does this?
Or some API that could be easily modified to work this way?

I don't know much about Java-programming or programming for Android, unfortunately.

Thanks for all your hints or ideas ...
Claudia.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

意犹 2024-11-13 09:08:31

可以为Android编写一个使用SensorManager 类,用于将值写入文件,由计时器驱动。然而,这基本上就违背了在 Flash 中开发应用程序的初衷(除非您这样做是因为您已经了解 Flash)。

如果这是一个 AIR 应用程序,则可能有一个 hack 可以让您访问 Android API:

http://elromdesign.com/blog/2010/10/29/hacking-native-android-with-air-app -to-allow-air-access-unavailable-apis/

我只是模糊地理解他们在做什么,我自己还没有尝试过。

You could write a "native" java application for Android that uses the SensorManager class to write values out to a file, driven by a Timer. However, this would pretty much defeat the purpose of doing the app in flash in the first place (unless you're doing this because you already know flash).

If this is an AIR app, there might be a hack that will let you access the Android APIs:

http://elromdesign.com/blog/2010/10/29/hacking-native-android-with-air-app-to-allow-air-access-unavailable-apis/

I only vaguely understand what they're doing and I haven't tried it myself.

千秋岁 2024-11-13 09:08:31

您可以简单地使用 Adob​​e Native Extensions,而不是采用将数据保存到 XML,然后在 Flash 中读取数据的肮脏解决方法(顺便说一句,这会很慢)。这是一种防止您编写和使用 Flash (Adobe AIR for Mobile) 的本机 Android 代码的机制。

请参阅此链接:
http://www.adobe.com/devnet/air/native -extensions-for-air.html

这里有一个教程:
http://www.adobe.com/devnet/air /articles/developing-native-extensions-air.html

Instead of doing a dirty workaround of saving the data to XML and then reading it in Flash, which will be slow btw, you can simply use Adobe Native Extensions. This is a mechanism that lest you write and use native Android code from Flash (Adobe AIR for Mobile).

Please see this link:
http://www.adobe.com/devnet/air/native-extensions-for-air.html

And a tutorial here:
http://www.adobe.com/devnet/air/articles/developing-native-extensions-air.html

清眉祭 2024-11-13 09:08:31

看看这个api演示 http: //developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.html

我想你可以在那里找到你需要的东西..

也看看
http://developer.android.com/reference/android/hardware/SensorManager.html
在 SENSOR_ORIENTATION 类型下

http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation(float[], float[])

SensorManager.getOrientation() 实际上可以返回您需要的值!

look in this api demo http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.html

i think you can find something you need there..

do also look in
http://developer.android.com/reference/android/hardware/SensorManager.html
under SENSOR_ORIENTATION type

http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation(float[], float[])

SensorManager.getOrientation() can actually return the values you need!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文