Category Archives: DansLocationAppBlog

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Messaging

The last chunk that I wanted to get done before the end of the semester was Messaging. It took me a while to wrap my head around how I was going to do it, and the way that I picked was definitely inefficient but it worked so I was happy.

This would require two tables in the sql server. Messages, which held the username of the person sending the message, the username of the person receiving the message, a timestamp and the actual message. The second table is the Message_Box. This had the to_user and from_user field and an incoming field which held an integer that specified the amount of messages sent by from_user to to_user that to_user hadn’t seen. Every time the message page was loaded the incoming field would be reset to 0 because all the messages from that user would be loaded. The real use of the incoming field is when two users are on their messaging pages and messaging each other. I have a method called StartMessageCheckingTask() that runs every second and checks if the incoming field for that user was higher than 0. If it was it would load the amount of incoming messages from from the bottom of the list of all messages sorted by their timestamp. Unfortunately this means that the sql server is being accessed every second while your on the messaging screen which isn’t the greatest but it was good enough for what I needed at the time.

Now a user could tap on a pin and a box saying “Message” would popup. Clicking on the popup would bring you to a messaging screen where you would be able to message the user who’s pin you had tapped.

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

Custom Rendering and New Problems

Now that I had profile pictures for users I wanted to display them when you tapped on a pin. I thought this would be easy to do but there was no options provided with pins to display pictures. After doing some research I found out that in order to customize pins you had to render them differently on different devices. Meaning you had to write separate code for iOS and Android.

What you needed to do is write a CustomRendering class in both the Android code and iOS code that extended the MapRenderer class. The MapRenderer class is called every time the Map is changed letting you manipulate how the map, but more importantly how the pins, are presented. On Android you can customize the View that is presented when tapping on a pin and have it display the users profile picture. On iOS the view presented is cut into three parts the LeftCalloutAccessoryView, the middle view, and the RightCalloutAccessoryView. I used the left accessory view to show the profile picture and the middle to show the title of the pin.

All of this was of course not done without any problems. At this point in time a lot things that were working in the past started to break. Mainly the Geolocator plugin, which meant I couldn’t get locations anymore. Most of my time was spent trying to fix this. I fixed it eventually by downgrading the plugin to a lower version and manually reinstalling the dependencies again.

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

Custom Rendering and New Problems

Now that I had profile pictures for users I wanted to display them when you tapped on a pin. I thought this would be easy to do but there was no options provided with pins to display pictures. After doing some research I found out that in order to customize pins you had to render them differently on different devices. Meaning you had to write separate code for iOS and Android.

What you needed to do is write a CustomRendering class in both the Android code and iOS code that extended the MapRenderer class. The MapRenderer class is called every time the Map is changed letting you manipulate how the map, but more importantly how the pins, are presented. On Android you can customize the View that is presented when tapping on a pin and have it display the users profile picture. On iOS the view presented is cut into three parts the LeftCalloutAccessoryView, the middle view, and the RightCalloutAccessoryView. I used the left accessory view to show the profile picture and the middle to show the title of the pin.

All of this was of course not done without any problems. At this point in time a lot things that were working in the past started to break. Mainly the Geolocator plugin, which meant I couldn’t get locations anymore. Most of my time was spent trying to fix this. I fixed it eventually by downgrading the plugin to a lower version and manually reinstalling the dependencies again.

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

Custom Rendering and New Problems

Now that I had profile pictures for users I wanted to display them when you tapped on a pin. I thought this would be easy to do but there was no options provided with pins to display pictures. After doing some research I found out that in order to customize pins you had to render them differently on different devices. Meaning you had to write separate code for iOS and Android.

What you needed to do is write a CustomRendering class in both the Android code and iOS code that extended the MapRenderer class. The MapRenderer class is called every time the Map is changed letting you manipulate how the map, but more importantly how the pins, are presented. On Android you can customize the View that is presented when tapping on a pin and have it display the users profile picture. On iOS the view presented is cut into three parts the LeftCalloutAccessoryView, the middle view, and the RightCalloutAccessoryView. I used the left accessory view to show the profile picture and the middle to show the title of the pin.

All of this was of course not done without any problems. At this point in time a lot things that were working in the past started to break. Mainly the Geolocator plugin, which meant I couldn’t get locations anymore. Most of my time was spent trying to fix this. I fixed it eventually by downgrading the plugin to a lower version and manually reinstalling the dependencies again.

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