创建地理围栏,同时将位置存储到 sqlite 数据库 [英] Create Geofence while storing the location to the sqlite database

查看:86
本文介绍了创建地理围栏,同时将位置存储到 sqlite 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 windows 移动应用程序.我想在将位置存储到 sqlite 数据库时创建地理围栏,以便在进入地理围栏时生成 SMS 警报.我正在通过地图将位置加载到文本框.

I am developing windows mobile application. I want to create geofence when storing the location to the sqlite database to generate SMS alerts when entering to the geofence. I am loading the location to the text boxes through map.

这是目前的代码

private void Load_Location(object sender, RoutedEventArgs e)
{
    LattxtBx.Text = String.Format("{0}", AddLocation.Center.Position.Latitude);
    LongtxtBx.Text = String.Format("{0}", AddLocation.Center.Position.Longitude);
}

private async void AddContact_Click(object sender, RoutedEventArgs e)
{
    DatabaseHelperClass Db_Helper = new DatabaseHelperClass();//Creating object for DatabaseHelperClass.cs from ViewModel/DatabaseHelperClass.cs 
    if (NametxtBx.Text != "" & AgetxtBx.Text != "" & AddresstxtBx.Text != "" & SchooltxtBx.Text != "" & GardienttxtBx.Text != "" & PhonetxtBx.Text != "" & LattxtBx.Text != "" & LongtxtBx.Text != "")
    {
        Db_Helper.Insert(new Contacts(NametxtBx.Text, AgetxtBx.Text, AddresstxtBx.Text, SchooltxtBx.Text, GardienttxtBx.Text, PhonetxtBx.Text, LattxtBx.Text, LongtxtBx.Text));
        Frame.Navigate(typeof(ReadContactList));//after add contact redirect to contact listbox page 
    }
    else
    {
        MessageDialog messageDialog = new MessageDialog("Please fill all fields");//Text should not be empty 
        await messageDialog.ShowAsync();
    }
}

推荐答案

Jan 编写了一个算法来检查经纬度是否在围栏内(经纬度列表)参见 这里

Jan has written an algorithm to check if a lat/long is inside a fence (a list of lat/longs) See here

这篇关于创建地理围栏,同时将位置存储到 sqlite 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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