Author Archives: Anonymous

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.