Category Archives: DansLocationAppBlog

Profile Pictures

Now that the user system was up I could add in profile pictures. For this I added a profile page which would hold the profile picture, buttons to let you upload a new picture, and a button to go to the map. The first step was letting the user pick the picture they wanted to use from the picture gallery on their phone. For this I used the Xam.Plugin.Media plugin which provides that functionality for Android and iOS. Next I added a new Table to the sql server which would store a persons username and their profile picture in a BLOB. BLOB stands for binary large object and is used to store large chunks of data. So the way it would work is a user would tap the upload picture button select a picture using the Media plugin that would then give us the picture converted into a byte array. The data in the array and the users username would then be stored in the sql server.

Next I had to take care of how someone would look like without a profile picture. I didn’t want to store a picture on the server for every person that didn’t have a profile picture so I found a “no avatar” picture and stored it in the resource folder on both iOS and Android. So when somebody that hadn’t uploaded a profile picture posted their location or went to their profile page the “no avatar” would be loaded from resources.

The final problem to take care of was having a uniform size for the profile pictures. For this I needed to be able to resize the pictures before storing them in the database. I tried using a plugin for it but the plugin would always maintain the aspect ratio of image meaning I would always get images with varying sizes. So instead I decided to code my own image resizer. The way this works is you write an interface in the shared code and then write two classes that extend it, one in the Android code and one in the iOS. Then when calling a method from the class you use Xamarins DependencyService which selects the correct class for you depending on what system its running on. So using this I wrote my own ImageResizer class that took an image byte array and resized it to whatever size I needed.

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

Profile Pictures

Now that the user system was up I could add in profile pictures. For this I added a profile page which would hold the profile picture, buttons to let you upload a new picture, and a button to go to the map. The first step was letting the user pick the picture they wanted to use from the picture gallery on their phone. For this I used the Xam.Plugin.Media plugin which provides that functionality for Android and iOS. Next I added a new Table to the sql server which would store a persons username and their profile picture in a BLOB. BLOB stands for binary large object and is used to store large chunks of data. So the way it would work is a user would tap the upload picture button select a picture using the Media plugin that would then give us the picture converted into a byte array. The data in the array and the users username would then be stored in the sql server.

Next I had to take care of how someone would look like without a profile picture. I didn’t want to store a picture on the server for every person that didn’t have a profile picture so I found a “no avatar” picture and stored it in the resource folder on both iOS and Android. So when somebody that hadn’t uploaded a profile picture posted their location or went to their profile page the “no avatar” would be loaded from resources.

The final problem to take care of was having a uniform size for the profile pictures. For this I needed to be able to resize the pictures before storing them in the database. I tried using a plugin for it but the plugin would always maintain the aspect ratio of image meaning I would always get images with varying sizes. So instead I decided to code my own image resizer. The way this works is you write an interface in the shared code and then write two classes that extend it, one in the Android code and one in the iOS. Then when calling a method from the class you use Xamarins DependencyService which selects the correct class for you depending on what system its running on. So using this I wrote my own ImageResizer class that took an image byte array and resized it to whatever size I needed.

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

Profile Pictures

Now that the user system was up I could add in profile pictures. For this I added a profile page which would hold the profile picture, buttons to let you upload a new picture, and a button to go to the map. The first step was letting the user pick the picture they wanted to use from the picture gallery on their phone. For this I used the Xam.Plugin.Media plugin which provides that functionality for Android and iOS. Next I added a new Table to the sql server which would store a persons username and their profile picture in a BLOB. BLOB stands for binary large object and is used to store large chunks of data. So the way it would work is a user would tap the upload picture button select a picture using the Media plugin that would then give us the picture converted into a byte array. The data in the array and the users username would then be stored in the sql server.

Next I had to take care of how someone would look like without a profile picture. I didn’t want to store a picture on the server for every person that didn’t have a profile picture so I found a “no avatar” picture and stored it in the resource folder on both iOS and Android. So when somebody that hadn’t uploaded a profile picture posted their location or went to their profile page the “no avatar” would be loaded from resources.

The final problem to take care of was having a uniform size for the profile pictures. For this I needed to be able to resize the pictures before storing them in the database. I tried using a plugin for it but the plugin would always maintain the aspect ratio of image meaning I would always get images with varying sizes. So instead I decided to code my own image resizer. The way this works is you write an interface in the shared code and then write two classes that extend it, one in the Android code and one in the iOS. Then when calling a method from the class you use Xamarins DependencyService which selects the correct class for you depending on what system its running on. So using this I wrote my own ImageResizer class that took an image byte array and resized it to whatever size I needed.

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

Profile Pictures

Now that the user system was up I could add in profile pictures. For this I added a profile page which would hold the profile picture, buttons to let you upload a new picture, and a button to go to the map. The first step was letting the user pick the picture they wanted to use from the picture gallery on their phone. For this I used the Xam.Plugin.Media plugin which provides that functionality for Android and iOS. Next I added a new Table to the sql server which would store a persons username and their profile picture in a BLOB. BLOB stands for binary large object and is used to store large chunks of data. So the way it would work is a user would tap the upload picture button select a picture using the Media plugin that would then give us the picture converted into a byte array. The data in the array and the users username would then be stored in the sql server.

Next I had to take care of how someone would look like without a profile picture. I didn’t want to store a picture on the server for every person that didn’t have a profile picture so I found a “no avatar” picture and stored it in the resource folder on both iOS and Android. So when somebody that hadn’t uploaded a profile picture posted their location or went to their profile page the “no avatar” would be loaded from resources.

The final problem to take care of was having a uniform size for the profile pictures. For this I needed to be able to resize the pictures before storing them in the database. I tried using a plugin for it but the plugin would always maintain the aspect ratio of image meaning I would always get images with varying sizes. So instead I decided to code my own image resizer. The way this works is you write an interface in the shared code and then write two classes that extend it, one in the Android code and one in the iOS. Then when calling a method from the class you use Xamarins DependencyService which selects the correct class for you depending on what system its running on. So using this I wrote my own ImageResizer class that took an image byte array and resized it to whatever size I needed.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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

Login Page and User System

The next thing to focus on was setting up a user system. For this I drew up a login page and added a User table to the sql server which holds the username and password. For a user system I would need to be able to create an account, check that the username used to create doesn’t exist, and, if the account already exists, check that the password is correct. All of this is done in php by polling the sql server. Once I got logging in to work I needed to make sure everything you do in the app is tied to your username. Which meant, for now, passing the username between pages and adding a username field to the Location table. Now locations stored in the server would also have the persons username attached to them. This let me add another button to the map that lets you only retrieve locations that you put down. Now that I had a user system in place I could start working on the more complicated aspects of the project.

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