Create Geofence while storing the location to the sqlite database [duplicate]

半世苍凉 提交于 2019-12-25 03:59:31

问题


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.

This is the code so far

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();
    }
}

回答1:


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



来源:https://stackoverflow.com/questions/34468690/create-geofence-while-storing-the-location-to-the-sqlite-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!