Android上的Sqlite:如何创建一个sqlite dist db函数 - 在app中用于使用lat进行距离计算,long [英] Sqlite on Android: How to create a sqlite dist db function - to be used in the app for distance calculation using lat, long

查看:242
本文介绍了Android上的Sqlite:如何创建一个sqlite dist db函数 - 在app中用于使用lat进行距离计算,long的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在构建一个Android应用程序,它将使用用户的当前位置(lat,long)并显示当前位置的前50个场所,按距离排序。

We are building an Android App that will use user's current location (lat, long) and show top 50 venues around the current location, sorted by distance.

我们将这些场所存储在SQLite DB中。我们计划随应用程序一起发布sqlite数据库。

We have these venues stored in an SQLite DB. We plan to ship with the sqlite DB with the app.

为了只获取相关的前50个最近的场地,我们想要定义一个db函数DIST(来计算)两点之间的距离)并在我们的查询中使用它。

In order to fetch only the relevant top 50 closest venues, we want to define a db function DIST (to calculate distance between two points) and use it in our query.

如何为Android应用程序定义自定义SQLite函数?这样做的Java API调用是什么?

我们已经在iPhone App中成功实现了这种方法 - 使用Objective C。

We have successfully implemented this approach in our iPhone App - using Objective C.

推荐答案

更新:答案是你不能这样做。

Update: The answer is that you can not do this.

来自:< a href =https://stackoverflow.com/questions/4124229/android-is-it-posible-to-write-custom-function-on-cc-and-use-it-in-sql-query> Android 。是否可以在C / C ++上编写自定义函数并在SQL查询中使用它?

这篇关于Android上的Sqlite:如何创建一个sqlite dist db函数 - 在app中用于使用lat进行距离计算,long的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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