So, I've been playing around with these policies, searching for resources and I figured I'd compile what I've extracted from other sources as well as what I've figured out on my own.
Disclaimer: I'm in no way an expert on the subject, so please take this information with a grain of salt.
First, my specs just so there's no confusion over how I managed to get something to work - a lot of this was done by trial and error. I'm currently running BES for Exchange 4.1.5 using SQL2005 Express, and my test phone is an 8310 with 126.96.36.199. To ensure you have the possibility of this working, check to see if you have a SyncLBS table in your database.
Next, you have to set up an IT Policy with the tracking on. You can find this under Location Based Services Policy Group. There's 4 items:
Disable Blackberry Maps
Enable Enterprise Location Tracking
Enterprise Location User Tracking Prompt Message
Enterprise Location Tracking Interval
Here are my settings:
Disable Blackberry Maps:
Enable Enterprise Location Tracking: True
Enterprise Location User Tracking Prompt Message: "Location is being tracked"
Enterprise Location Tracking Interval: 15
And the results are: mixed. Like I said, I played around with this for some time. The message itself did not send to the blackberry, although the user is prompted with a canned message and the choice of whether or not to turn it on as soon as the policy is sent and processed. I also don't know if you need the quotes - neither message showed up either way so it's moot.
The first time I sent the policy, I got one update and never again. However, I did do this at work where I don't get a GPS signal indoors. At home, it's not a problem and I tried it again. I sent a non-LBS policy to the phone and then resent the LBS enable policy to it. This time is seemed to work. I should mention that I also deleted out the record in the SQL database - I have NO idea whether or not it was being able access the GPS at home, or whether deleting the record and forcing it to create another one solved the problem. The phone also sends the data every 10 minutes instead of 15, and sometimes sends it 4 times in a few seconds. It will also skip periods of time and I'm not sure why. I ran an errand the other day and I know the GPS most likely couldn't see the satellites, but it didn't start reporting again until over an hour had pass (long after I came back outside).
Speaking of the database and this SyncLBS table, here is the table structure:
ID: Autunumber field - nuff said
UserConfigID: References the UserConfig Table
RecordType: Unknown, although every record type I've seen is 1
RecordTimeStamp: Clearly a Timestamp but I haven't deciphered it yet
ServerTime: A time stamp. This is the number of seconds that have passed since 1/1/1970 12:00:00 AM
Latitude: Divide by 100000 to get the proper Latitude
Longitude: Divide by 100000 to get the proper Longitude
Altitude: I'm assuming this is in meters, although it's horribly inaccurate and not even displayed on the phone anywhere. If someone wants to climb a mountain to check this, go right ahead! :D
DeviceStatus: 0 or 1. Mostly 1's. Still trying to figure out what this is referring to
So one of the things that is clear as that it only shows the last result - there is no record of previous entries - it simply updates the one and only record per UserConfigID. So I decided to correct that with a trigger. First I made a table called SyncLBSLog with the following columns, identical to the SyncLBS table:
and set the Primary Key to both the UserConfigID and the RecordTimestamp
Then I added a trigger to the SyncLBS table:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
CREATE TRIGGER [CopyToLog]
SET NOCOUNT ON;
INSERT INTO SyncLBSLog
(RecordType, RecordTimestamp, ServerTime, Latitude, Longitude, Altitude, DeviceStatus, UserConfigId)
SELECT RecordType, RecordTimestamp, ServerTime, Latitude, Longitude, Altitude, DeviceStatus, UserConfigId
FROM SyncLBS s
Where not exists (select * from dbo.SyncLBSLog d
Where d.RecordTimestamp = s.RecordTimestamp and d.UserConfigID = s.UserConfigID) and RecordTimestamp <> 0
This basically appends each SyncLBS record if it changes into the SyncLBSLog table. And voila, I can now trace back to where a BB was a certain time. Big brother no?
Wondering how you can actually use this information? I know access very well so I linked the tables to access and ran some queries on it:
SELECT dbo_SyncLBSLog.UserConfigId, dbo_SyncLBSLog.RecordType, dbo_SyncLBSLog.RecordTimestamp, dbo_SyncLBSLog.ServerTime, dbo_SyncLBSLog.Latitude, dbo_SyncLBSLog.Longitude, dbo_SyncLBSLog.Altitude, dbo_SyncLBSLog.DeviceStatus, [ServerTime]-(7*3600) AS CorrectedTime, [Latitude]/100000 AS CorrectedLatitude, [Longitude]/100000 AS CorrectedLongitude, DateSerial(1970,1,1+Int([CorrectedTime]/86400)) & " " & TimeSerial(Int(([Correctedtime] Mod 86400)/3600),0,[CorrectedTime] Mod 86400-Int(([CorrectedTime] Mod 86400)/3600)*3600) AS CorrectedDateStamp, DateSerial(1970,1,1+Int([Correctedtime]/86400)) AS CorrectedDate, Int(([CorrectedTime] Mod 86400)/3600) AS CorrectedHour
ORDER BY dbo_SyncLBSLog.ServerTime;
Please note the CorrectedTime - this converts it into my local time zone - correct as needed.
After this has run for a few days, the massive amount of data is pretty enormous, so I ran another query to grab only one piece of data per hour per person (the last record per hour):
SELECT GPSLogCorrected.UserConfigId, GPSLogCorrected.CorrectedDate, GPSLogCorrected.CorrectedHour, Max(GPSLogCorrected.CorrectedTime) AS MaxOfCorrectedTime
GROUP BY GPSLogCorrected.UserConfigId, GPSLogCorrected.CorrectedDate, GPSLogCorrected.CorrectedHour;
And then used this to create KML tags:
SELECT "<Placemark><name>" & [DisplayName] & " (" & [CorrectedDateStamp] & ")</name><Point><coordinates>" & [Longitude]/100000 & "," & [Latitude]/100000 & "</coordinates></Point></Placemark>" AS XML
FROM (dbo_UserConfig INNER JOIN LastHour ON dbo_UserConfig.Id = LastHour.UserConfigId) INNER JOIN GPSLogCorrected ON (LastHour.MaxOfCorrectedTime = GPSLogCorrected.CorrectedTime) AND (LastHour.UserConfigId = GPSLogCorrected.UserConfigId)
ORDER BY dbo_UserConfig.Id, LastHour.MaxOfCorrectedTime;
Sandwich the output of that between this:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http:/ /earth.google.com/kml/2.2">
(Remove the space between the two /'s)
and you have a KML file suitable for Google Earth.