├── .gitignore ├── LICENSE ├── README.md ├── SamplePhotos ├── androidmap.gif ├── droidplace.gif ├── iOSmap.gif ├── mapstyle.png ├── movingpindrod.gif ├── movingpiniOS.gif └── placeios.gif ├── TrackingSample.Android ├── Assets │ ├── AboutAssets.txt │ └── ic_taxi.png ├── CachingNativeBitmapDescriptorFactory.cs ├── MainActivity.cs ├── MainApplication.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── drawable-hdpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── drawable-ldpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── drawable-mdpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── drawable-xhdpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── drawable-xxhdpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── drawable-xxxhdpi │ │ ├── ic_location.png │ │ ├── ic_location_red.png │ │ ├── ic_search.png │ │ └── ic_taxi.png │ ├── layout │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ ├── mipmap-hdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ └── values │ │ ├── colors.xml │ │ └── styles.xml └── TrackingSample.Android.csproj ├── TrackingSample.iOS ├── AppDelegate.cs ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png ├── Entitlements.plist ├── Info.plist ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── LaunchScreen.storyboard │ ├── ic_location.png │ ├── ic_location@2x.png │ ├── ic_location@3x.png │ ├── ic_location_red.png │ ├── ic_location_red@2x.png │ ├── ic_location_red@3x.png │ ├── ic_search.png │ ├── ic_search@2x.png │ ├── ic_search@3x.png │ ├── ic_taxi.png │ └── ic_taxi@2x.png └── TrackingSample.iOS.csproj ├── TrackingSample.sln └── TrackingSample ├── App.xaml ├── App.xaml.cs ├── Constants.cs ├── Controls └── ExtendedGoogleMaps.cs ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── Helpers └── PolylineHelper.cs ├── MapStyle.json ├── Models ├── GoogleDirection.cs ├── GooglePlace.cs └── GooglePlaceAutoCompletePrediction.cs ├── Services ├── GoogleMapsApiService.cs └── IGoogleMapsApiService.cs ├── TrackingSample.csproj ├── ViewModels └── MainViewModel.cs └── Views ├── MainPage.xaml ├── MainPage.xaml.cs ├── SearchPlacePage.xaml └── SearchPlacePage.xaml.cs /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 CrossGeeks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Map Tracking Sample 2 | Map Tracking Sample in Xamarin Forms 3 | 4 | 5 |

6 | 7 |         8 | 9 |

10 | 11 | Blog post: [Exploring Map Tracking UI in Xamarin Forms](http://www.xamboy.com/2019/05/17/exploring-map-tracking-ui-in-xamarin-forms/) 12 | 13 | Search Place Sample in Xamarin Forms 14 | 15 |

16 | 17 |         18 | 19 |

20 | 21 | Blog post: [Place Searches in Google Maps on Xamarin Forms](http://www.xamboy.com/2019/05/29/google-maps-place-search-in-xamarin-forms/) 22 | 23 | 24 | Setting pickup location marker using Google Maps in Xamarin Forms 25 | 26 |

27 | 28 |         29 | 30 |

31 | 32 | Blog post: [Setting pickup location marker using Google Maps in Xamarin Forms](http://www.xamboy.com/2019/06/05/setting-pickup-location-marker-using-google-maps-in-xamarin-forms/) 33 | 34 | Google map Styling in Xamarin Forms 35 | 36 |

37 | 38 |

39 | 40 | Blog post: [Google map Styling in Xamarin Forms](http://www.xamboy.com/2019/06/13/google-maps-styling-in-xamarin-forms/) 41 | 42 | -------------------------------------------------------------------------------- /SamplePhotos/androidmap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/androidmap.gif -------------------------------------------------------------------------------- /SamplePhotos/droidplace.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/droidplace.gif -------------------------------------------------------------------------------- /SamplePhotos/iOSmap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/iOSmap.gif -------------------------------------------------------------------------------- /SamplePhotos/mapstyle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/mapstyle.png -------------------------------------------------------------------------------- /SamplePhotos/movingpindrod.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/movingpindrod.gif -------------------------------------------------------------------------------- /SamplePhotos/movingpiniOS.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/movingpiniOS.gif -------------------------------------------------------------------------------- /SamplePhotos/placeios.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/SamplePhotos/placeios.gif -------------------------------------------------------------------------------- /TrackingSample.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with you package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /TrackingSample.Android/Assets/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Assets/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/CachingNativeBitmapDescriptorFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using Xamarin.Forms.GoogleMaps; 3 | using Xamarin.Forms.GoogleMaps.Android.Factories; 4 | using AndroidBitmapDescriptor = Android.Gms.Maps.Model.BitmapDescriptor; 5 | 6 | namespace TrackingSample.Droid 7 | { 8 | public sealed class CachingNativeBitmapDescriptorFactory : IBitmapDescriptorFactory 9 | { 10 | private readonly ConcurrentDictionary _cache 11 | = new ConcurrentDictionary(); 12 | 13 | public AndroidBitmapDescriptor ToNative(BitmapDescriptor descriptor) 14 | { 15 | var defaultFactory = DefaultBitmapDescriptorFactory.Instance; 16 | 17 | if (!string.IsNullOrEmpty(descriptor.Id)) 18 | { 19 | var cacheEntry = _cache.GetOrAdd(descriptor.Id, _ => defaultFactory.ToNative(descriptor)); 20 | return cacheEntry; 21 | } 22 | 23 | return defaultFactory.ToNative(descriptor); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /TrackingSample.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | using Android.Runtime; 5 | using Xamarin.Forms.GoogleMaps.Android; 6 | 7 | namespace TrackingSample.Droid 8 | { 9 | [Activity(Label = "TrackingSample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 10 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 11 | { 12 | protected override void OnCreate(Bundle savedInstanceState) 13 | { 14 | TabLayoutResource = Resource.Layout.Tabbar; 15 | ToolbarResource = Resource.Layout.Toolbar; 16 | 17 | base.OnCreate(savedInstanceState); 18 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 19 | 20 | // Override default BitmapDescriptorFactory by your implementation. 21 | var platformConfig = new PlatformConfig 22 | { 23 | BitmapDescriptorFactory = new CachingNativeBitmapDescriptorFactory() 24 | }; 25 | 26 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 27 | Xamarin.FormsGoogleMaps.Init(this,savedInstanceState, platformConfig); // initialize for Xamarin.Forms.GoogleMaps 28 | LoadApplication(new App()); 29 | } 30 | 31 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 32 | { 33 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 34 | Plugin.Permissions.PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); 35 | 36 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /TrackingSample.Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.App; 3 | using Android.Runtime; 4 | using Plugin.CurrentActivity; 5 | 6 | namespace TrackingSample.Droid 7 | { 8 | #if DEBUG 9 | [Application(Debuggable = true)] 10 | #else 11 | [Application(Debuggable = false)] 12 | #endif 13 | [MetaData("com.google.android.maps.v2.API_KEY", 14 | Value = Constants.GoogleMapsApiKey)] 15 | public class MainApplication : Application 16 | { 17 | public MainApplication(IntPtr handle, JniHandleOwnership transer) 18 | : base(handle, transer) 19 | { 20 | } 21 | 22 | public override void OnCreate() 23 | { 24 | base.OnCreate(); 25 | CrossCurrentActivity.Current.Init(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /TrackingSample.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /TrackingSample.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("TrackingSample.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("TrackingSample.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-hdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-hdpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-hdpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-hdpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-hdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-hdpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-hdpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-hdpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-ldpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-ldpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-ldpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-ldpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-ldpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-ldpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-ldpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-ldpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-mdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-mdpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-mdpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-mdpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-mdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-mdpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-mdpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-mdpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xhdpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xhdpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xhdpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xhdpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xhdpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xhdpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxhdpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxhdpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxhdpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxhdpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxhdpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxhdpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxxhdpi/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxxhdpi/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxxhdpi/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxxhdpi/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/drawable-xxxhdpi/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/drawable-xxxhdpi/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | -------------------------------------------------------------------------------- /TrackingSample.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 24 | 27 | -------------------------------------------------------------------------------- /TrackingSample.Android/TrackingSample.Android.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | TrackingSample.Droid 11 | TrackingSample.Android 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | v10.0 19 | Xamarin.Android.Net.AndroidClientHandler 20 | 21 | 22 | 23 | 24 | true 25 | portable 26 | false 27 | bin\Debug 28 | DEBUG; 29 | prompt 30 | 4 31 | None 32 | 33 | 34 | true 35 | pdbonly 36 | true 37 | bin\Release 38 | prompt 39 | 4 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 3.3.0 61 | 62 | 63 | 2.1.0.4 64 | 65 | 66 | 1.5.3.1 67 | 68 | 69 | 6.0.1 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | {108705E3-F78A-4C82-AB8E-99170DC0052B} 138 | TrackingSample 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /TrackingSample.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace TrackingSample.iOS 9 | { 10 | // The UIApplicationDelegate for the application. This class is responsible for launching the 11 | // User Interface of the application, as well as listening (and optionally responding) to 12 | // application events from iOS. 13 | [Register("AppDelegate")] 14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 15 | { 16 | // 17 | // This method is invoked when the application has loaded and is ready to run. In this 18 | // method you should instantiate the window, load the UI into it and then make the window 19 | // visible. 20 | // 21 | // You have 17 seconds to return from this method, or iOS will terminate your application. 22 | // 23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 24 | { 25 | global::Xamarin.Forms.Forms.Init(); 26 | Xamarin.FormsGoogleMaps.Init(Constants.GoogleMapsApiKey); 27 | LoadApplication(new App()); 28 | 29 | return base.FinishedLaunching(app, options); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 12.1 25 | CFBundleDisplayName 26 | TrackingSample 27 | CFBundleIdentifier 28 | com.crossgeeks.trackingsample 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | CFBundleName 32 | TrackingSample 33 | XSAppIconAssets 34 | Assets.xcassets/AppIcon.appiconset 35 | NSLocationAlwaysUsageDescription 36 | Need access to your location 37 | NSLocationWhenInUseUsageDescription 38 | Need access to your location 39 | NSLocationAlwaysAndWhenInUseUsageDescription 40 | Need access to your location 41 | NSLocationUsageDescription 42 | Need access to your location 43 | CFBundleShortVersionString 44 | 1.0 45 | CFBundleVersion 46 | 1 47 | 48 | 49 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace TrackingSample.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TrackingSample.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TrackingSample.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/Default.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location@3x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location_red.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location_red@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location_red@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_location_red@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_location_red@3x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_search.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_search@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_search@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_search@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_search@3x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_taxi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_taxi.png -------------------------------------------------------------------------------- /TrackingSample.iOS/Resources/ic_taxi@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdelrosario/MapTrackingSample/1677bd9e7c6007a43feacda282f6f38f7b294f07/TrackingSample.iOS/Resources/ic_taxi@2x.png -------------------------------------------------------------------------------- /TrackingSample.iOS/TrackingSample.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {280F0033-73AD-4B5F-B349-56E8CF824056} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | TrackingSample.iOS 13 | Resources 14 | TrackingSample.iOS 15 | NSUrlSessionHandler 16 | 17 | 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\iPhoneSimulator\Debug 24 | DEBUG 25 | prompt 26 | 4 27 | false 28 | i386, x86_64 29 | None 30 | true 31 | iPhone Developer 32 | 33 | 34 | none 35 | true 36 | bin\iPhoneSimulator\Release 37 | prompt 38 | 4 39 | None 40 | x86_64 41 | false 42 | 43 | 44 | true 45 | full 46 | false 47 | bin\iPhone\Debug 48 | DEBUG 49 | prompt 50 | 4 51 | false 52 | ARM64 53 | iPhone Developer 54 | true 55 | Entitlements.plist 56 | 57 | 58 | none 59 | true 60 | bin\iPhone\Release 61 | prompt 62 | 4 63 | ARM64 64 | false 65 | iPhone Developer 66 | Entitlements.plist 67 | 68 | 69 | none 70 | True 71 | bin\iPhone\Ad-Hoc 72 | prompt 73 | 4 74 | False 75 | ARM64 76 | True 77 | Automatic:AdHoc 78 | iPhone Distribution 79 | Entitlements.plist 80 | 81 | 82 | none 83 | True 84 | bin\iPhone\AppStore 85 | prompt 86 | 4 87 | False 88 | ARM64 89 | Automatic:AppStore 90 | iPhone Distribution 91 | Entitlements.plist 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | false 104 | 105 | 106 | false 107 | 108 | 109 | false 110 | 111 | 112 | false 113 | 114 | 115 | false 116 | 117 | 118 | false 119 | 120 | 121 | false 122 | 123 | 124 | false 125 | 126 | 127 | false 128 | 129 | 130 | false 131 | 132 | 133 | false 134 | 135 | 136 | false 137 | 138 | 139 | false 140 | 141 | 142 | false 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 1.5.3.1 155 | 156 | 157 | 3.3.0 158 | 159 | 160 | 3.5.0 161 | 162 | 163 | 0.4.11 164 | 165 | 166 | 167 | 168 | 169 | {108705E3-F78A-4C82-AB8E-99170DC0052B} 170 | TrackingSample 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /TrackingSample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackingSample.Android", "TrackingSample.Android\TrackingSample.Android.csproj", "{D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackingSample.iOS", "TrackingSample.iOS\TrackingSample.iOS.csproj", "{280F0033-73AD-4B5F-B349-56E8CF824056}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackingSample", "TrackingSample\TrackingSample.csproj", "{108705E3-F78A-4C82-AB8E-99170DC0052B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 15 | Release|iPhoneSimulator = Release|iPhoneSimulator 16 | Debug|iPhone = Debug|iPhone 17 | Release|iPhone = Release|iPhone 18 | Ad-Hoc|iPhone = Ad-Hoc|iPhone 19 | AppStore|iPhone = AppStore|iPhone 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 27 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 28 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 29 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 30 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|iPhone.ActiveCfg = Debug|Any CPU 31 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Debug|iPhone.Build.0 = Debug|Any CPU 32 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|iPhone.ActiveCfg = Release|Any CPU 33 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Release|iPhone.Build.0 = Release|Any CPU 34 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU 35 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU 36 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.AppStore|iPhone.ActiveCfg = Debug|Any CPU 37 | {D3F4F4BC-CA68-4548-9F5C-51DEEB2DE753}.AppStore|iPhone.Build.0 = Debug|Any CPU 38 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 39 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 40 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator 41 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|Any CPU.Build.0 = Release|iPhoneSimulator 42 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 43 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 44 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 45 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 46 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|iPhone.ActiveCfg = Debug|iPhone 47 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Debug|iPhone.Build.0 = Debug|iPhone 48 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|iPhone.ActiveCfg = Release|iPhone 49 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Release|iPhone.Build.0 = Release|iPhone 50 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone 51 | {280F0033-73AD-4B5F-B349-56E8CF824056}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone 52 | {280F0033-73AD-4B5F-B349-56E8CF824056}.AppStore|iPhone.ActiveCfg = AppStore|iPhone 53 | {280F0033-73AD-4B5F-B349-56E8CF824056}.AppStore|iPhone.Build.0 = AppStore|iPhone 54 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 59 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 60 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 61 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 62 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|iPhone.ActiveCfg = Debug|Any CPU 63 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Debug|iPhone.Build.0 = Debug|Any CPU 64 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|iPhone.ActiveCfg = Release|Any CPU 65 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Release|iPhone.Build.0 = Release|Any CPU 66 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU 67 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU 68 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU 69 | {108705E3-F78A-4C82-AB8E-99170DC0052B}.AppStore|iPhone.Build.0 = Debug|Any CPU 70 | EndGlobalSection 71 | EndGlobal 72 | -------------------------------------------------------------------------------- /TrackingSample/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TrackingSample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TrackingSample.Services; 3 | using Xamarin.Forms; 4 | using Xamarin.Forms.Xaml; 5 | 6 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] 7 | namespace TrackingSample 8 | { 9 | public partial class App : Application 10 | { 11 | public App() 12 | { 13 | InitializeComponent(); 14 | GoogleMapsApiService.Initialize(Constants.GoogleMapsApiKey); 15 | MainPage = new NavigationPage(new MainPage()) { BarTextColor=Color.Black}; 16 | } 17 | 18 | protected override void OnStart() 19 | { 20 | // Handle when your app starts 21 | } 22 | 23 | protected override void OnSleep() 24 | { 25 | // Handle when your app sleeps 26 | } 27 | 28 | protected override void OnResume() 29 | { 30 | // Handle when your app resumes 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TrackingSample/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace TrackingSample 3 | { 4 | public static class Constants 5 | { 6 | public const string GoogleMapsApiKey= "--Add your google map api key here--"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /TrackingSample/Controls/ExtendedGoogleMaps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | using Xamarin.Essentials; 8 | using Xamarin.Forms; 9 | using Xamarin.Forms.GoogleMaps; 10 | 11 | namespace TrackingSample.Controls 12 | { 13 | public class ExtendedMap : Xamarin.Forms.GoogleMaps.Map 14 | { 15 | public static readonly BindableProperty CalculateCommandProperty = 16 | BindableProperty.Create(nameof(CalculateCommand), typeof(ICommand), typeof(MainPage), null, BindingMode.TwoWay); 17 | 18 | public ICommand CalculateCommand 19 | { 20 | get { return (ICommand)GetValue(CalculateCommandProperty); } 21 | set { SetValue(CalculateCommandProperty, value); } 22 | } 23 | 24 | public static readonly BindableProperty UpdateCommandProperty = 25 | BindableProperty.Create(nameof(UpdateCommand), typeof(ICommand), typeof(MainPage), null, BindingMode.TwoWay); 26 | 27 | public ICommand UpdateCommand 28 | { 29 | get { return (ICommand)GetValue(UpdateCommandProperty); } 30 | set { SetValue(UpdateCommandProperty, value); } 31 | } 32 | 33 | public static readonly BindableProperty GetActualLocationCommandProperty = 34 | BindableProperty.Create(nameof(GetActualLocationCommand), typeof(ICommand), typeof(MainPage), null, BindingMode.TwoWay); 35 | 36 | public ICommand GetActualLocationCommand 37 | { 38 | get { return (ICommand)GetValue(GetActualLocationCommandProperty); } 39 | set { SetValue(GetActualLocationCommandProperty, value); } 40 | } 41 | 42 | public event EventHandler OnCalculate = delegate { }; 43 | public event EventHandler OnLocationError = delegate {}; 44 | 45 | public ExtendedMap() 46 | { 47 | 48 | AddMapStyle(); 49 | } 50 | 51 | protected override void OnBindingContextChanged() 52 | { 53 | base.OnBindingContextChanged(); 54 | if(BindingContext !=null) 55 | { 56 | CalculateCommand = new Command>(Calculate); 57 | UpdateCommand = new Command(Update); 58 | GetActualLocationCommand = new Command(async () => await GetActualLocation()); 59 | } 60 | } 61 | 62 | void AddMapStyle() 63 | { 64 | var assembly = typeof(ExtendedMap).GetTypeInfo().Assembly; 65 | var stream = assembly.GetManifestResourceStream($"TrackingSample.MapStyle.json"); 66 | string styleFile; 67 | using (var reader = new System.IO.StreamReader(stream)) 68 | { 69 | styleFile = reader.ReadToEnd(); 70 | } 71 | 72 | MapStyle = MapStyle.FromJson(styleFile); 73 | } 74 | 75 | 76 | async void Update(Xamarin.Forms.GoogleMaps.Position position) 77 | { 78 | if (Pins.Count == 1 && Polylines != null && Polylines?.Count > 1) 79 | return; 80 | 81 | var cPin = Pins.FirstOrDefault(); 82 | 83 | if (cPin != null) 84 | { 85 | cPin.Position = new Position(position.Latitude, position.Longitude); 86 | cPin.Icon = (Device.RuntimePlatform == Device.Android) ? BitmapDescriptorFactory.FromBundle("ic_taxi.png") : BitmapDescriptorFactory.FromView(new Image() { Source = "ic_taxi.png", WidthRequest = 25, HeightRequest = 25 }); 87 | 88 | await MoveCamera(CameraUpdateFactory.NewPosition(new Position(position.Latitude, position.Longitude))); 89 | var previousPosition = Polylines?.FirstOrDefault()?.Positions?.FirstOrDefault(); 90 | Polylines?.FirstOrDefault()?.Positions?.Remove(previousPosition.Value); 91 | } 92 | else 93 | { 94 | //END TRIP 95 | Polylines?.FirstOrDefault()?.Positions?.Clear(); 96 | } 97 | 98 | 99 | } 100 | 101 | void Calculate(List list) 102 | { 103 | OnCalculate?.Invoke(this, default(EventArgs)); 104 | Polylines.Clear(); 105 | var polyline = new Xamarin.Forms.GoogleMaps.Polyline(); 106 | foreach (var p in list) 107 | { 108 | polyline.Positions.Add(p); 109 | 110 | } 111 | Polylines.Add(polyline); 112 | MoveToRegion(MapSpan.FromCenterAndRadius(new Position(polyline.Positions[0].Latitude, polyline.Positions[0].Longitude), Xamarin.Forms.GoogleMaps.Distance.FromMiles(0.50f))); 113 | 114 | var pin = new Xamarin.Forms.GoogleMaps.Pin 115 | { 116 | Type = PinType.Place, 117 | Position = new Position(polyline.Positions.First().Latitude, polyline.Positions.First().Longitude), 118 | Label = "First", 119 | Address = "First", 120 | Tag = string.Empty, 121 | Icon = (Device.RuntimePlatform == Device.Android) ? BitmapDescriptorFactory.FromBundle("ic_taxi.png") : BitmapDescriptorFactory.FromView(new Image() { Source = "ic_taxi.png", WidthRequest = 25, HeightRequest = 25 }) 122 | 123 | }; 124 | Pins.Add(pin); 125 | var pin1 = new Xamarin.Forms.GoogleMaps.Pin 126 | { 127 | Type = PinType.Place, 128 | Position = new Position(polyline.Positions.Last().Latitude, polyline.Positions.Last().Longitude), 129 | Label = "Last", 130 | Address = "Last", 131 | Tag = string.Empty 132 | }; 133 | Pins.Add(pin1); 134 | } 135 | 136 | async Task GetActualLocation() 137 | { 138 | try 139 | { 140 | var request = new GeolocationRequest(GeolocationAccuracy.High); 141 | var location = await Geolocation.GetLocationAsync(request); 142 | 143 | if (location != null) 144 | { 145 | MoveToRegion(MapSpan.FromCenterAndRadius( 146 | new Position(location.Latitude, location.Longitude), Distance.FromMiles(0.3))); 147 | 148 | } 149 | } 150 | catch (Exception ex) 151 | { 152 | OnLocationError?.Invoke(this, default(EventArgs)); 153 | } 154 | } 155 | 156 | 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /TrackingSample/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /TrackingSample/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Used to control if the On_PropertyName_Changed feature is enabled. 12 | 13 | 14 | 15 | 16 | Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. 17 | 18 | 19 | 20 | 21 | Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. 22 | 23 | 24 | 25 | 26 | Used to control if equality checks should use the Equals method resolved from the base class. 27 | 28 | 29 | 30 | 31 | Used to control if equality checks should use the static Equals method resolved from the base class. 32 | 33 | 34 | 35 | 36 | Used to turn off build warnings from this weaver. 37 | 38 | 39 | 40 | 41 | Used to turn off build warnings about mismatched On_PropertyName_Changed methods. 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 50 | 51 | 52 | 53 | 54 | A comma-separated list of error codes that can be safely ignored in assembly verification. 55 | 56 | 57 | 58 | 59 | 'false' to turn off automatic generation of the XML Schema file. 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /TrackingSample/Helpers/PolylineHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Xamarin.Forms.GoogleMaps; 5 | 6 | namespace TrackingSample.Helpers 7 | { 8 | public static class PolylineHelper 9 | { 10 | /// 11 | /// Decode google style polyline coordinates. 12 | /// 13 | /// 14 | /// 15 | public static IEnumerable Decode(string encodedPoints) 16 | { 17 | if (string.IsNullOrEmpty(encodedPoints)) 18 | throw new ArgumentNullException("encodedPoints"); 19 | 20 | char[] polylineChars = encodedPoints.ToCharArray(); 21 | int index = 0; 22 | 23 | int currentLat = 0; 24 | int currentLng = 0; 25 | int next5bits; 26 | int sum; 27 | int shifter; 28 | 29 | while (index < polylineChars.Length) 30 | { 31 | // calculate next latitude 32 | sum = 0; 33 | shifter = 0; 34 | do 35 | { 36 | next5bits = (int)polylineChars[index++] - 63; 37 | sum |= (next5bits & 31) << shifter; 38 | shifter += 5; 39 | } while (next5bits >= 32 && index < polylineChars.Length); 40 | 41 | if (index >= polylineChars.Length) 42 | break; 43 | 44 | currentLat += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1); 45 | 46 | //calculate next longitude 47 | sum = 0; 48 | shifter = 0; 49 | do 50 | { 51 | next5bits = (int)polylineChars[index++] - 63; 52 | sum |= (next5bits & 31) << shifter; 53 | shifter += 5; 54 | } while (next5bits >= 32 && index < polylineChars.Length); 55 | 56 | if (index >= polylineChars.Length && next5bits >= 32) 57 | break; 58 | 59 | currentLng += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1); 60 | 61 | yield return new Position(Convert.ToDouble(currentLat) / 1E5, Convert.ToDouble(currentLng) / 1E5); 62 | 63 | } 64 | } 65 | 66 | /// 67 | /// Encode it 68 | /// 69 | /// 70 | /// 71 | public static string Encode(IEnumerable points) 72 | { 73 | var str = new StringBuilder(); 74 | 75 | var encodeDiff = (Action)(diff => 76 | { 77 | int shifted = diff << 1; 78 | if (diff < 0) 79 | shifted = ~shifted; 80 | 81 | int rem = shifted; 82 | 83 | while (rem >= 0x20) 84 | { 85 | str.Append((char)((0x20 | (rem & 0x1f)) + 63)); 86 | 87 | rem >>= 5; 88 | } 89 | 90 | str.Append((char)(rem + 63)); 91 | }); 92 | 93 | int lastLat = 0; 94 | int lastLng = 0; 95 | 96 | foreach (var point in points) 97 | { 98 | int lat = (int)Math.Round(point.Latitude * 1E5); 99 | int lng = (int)Math.Round(point.Longitude * 1E5); 100 | 101 | encodeDiff(lat - lastLat); 102 | encodeDiff(lng - lastLng); 103 | 104 | lastLat = lat; 105 | lastLng = lng; 106 | } 107 | 108 | return str.ToString(); 109 | } 110 | 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /TrackingSample/MapStyle.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "featureType": "landscape.natural", 4 | "elementType": "geometry", 5 | "stylers": [ 6 | { 7 | "color": "#dde2e3" 8 | }, 9 | { 10 | "visibility": "on" 11 | } 12 | ] 13 | }, 14 | { 15 | "featureType": "poi.park", 16 | "elementType": "all", 17 | "stylers": [ 18 | { 19 | "color": "#c6e8b3" 20 | }, 21 | { 22 | "visibility": "on" 23 | } 24 | ] 25 | }, 26 | { 27 | "featureType": "poi.park", 28 | "elementType": "geometry.fill", 29 | "stylers": [ 30 | { 31 | "color": "#b0ddba" 32 | }, 33 | { 34 | "visibility": "on" 35 | } 36 | ] 37 | }, 38 | { 39 | "featureType": "poi.park", 40 | "elementType": "geometry.stroke", 41 | "stylers": [ 42 | { 43 | "hue": "#ff0000" 44 | } 45 | ] 46 | }, 47 | { 48 | "featureType": "poi.park", 49 | "elementType": "labels.text.fill", 50 | "stylers": [ 51 | { 52 | "saturation": "-90" 53 | }, 54 | { 55 | "lightness": "58" 56 | }, 57 | { 58 | "color": "#6da379" 59 | }, 60 | { 61 | "gamma": "0.69" 62 | }, 63 | { 64 | "weight": "0.52" 65 | } 66 | ] 67 | }, 68 | { 69 | "featureType": "poi.park", 70 | "elementType": "labels.text.stroke", 71 | "stylers": [ 72 | { 73 | "color": "#000000" 74 | }, 75 | { 76 | "weight": "0.61" 77 | }, 78 | { 79 | "lightness": "-100" 80 | }, 81 | { 82 | "gamma": "0.00" 83 | }, 84 | { 85 | "saturation": "-76" 86 | }, 87 | { 88 | "visibility": "off" 89 | } 90 | ] 91 | }, 92 | { 93 | "featureType": "road", 94 | "elementType": "geometry.fill", 95 | "stylers": [ 96 | { 97 | "visibility": "on" 98 | } 99 | ] 100 | }, 101 | { 102 | "featureType": "road", 103 | "elementType": "geometry.stroke", 104 | "stylers": [ 105 | { 106 | "visibility": "off" 107 | } 108 | ] 109 | }, 110 | { 111 | "featureType": "road", 112 | "elementType": "labels", 113 | "stylers": [ 114 | { 115 | "visibility": "on" 116 | } 117 | ] 118 | }, 119 | { 120 | "featureType": "road", 121 | "elementType": "labels.text.fill", 122 | "stylers": [ 123 | { 124 | "visibility": "on" 125 | } 126 | ] 127 | }, 128 | { 129 | "featureType": "road", 130 | "elementType": "labels.text.stroke", 131 | "stylers": [ 132 | { 133 | "visibility": "on" 134 | } 135 | ] 136 | }, 137 | { 138 | "featureType": "road.highway", 139 | "elementType": "geometry.fill", 140 | "stylers": [ 141 | { 142 | "color": "#a6b5dd" 143 | }, 144 | { 145 | "visibility": "on" 146 | }, 147 | { 148 | "weight": "0.87" 149 | }, 150 | { 151 | "lightness": "-7" 152 | } 153 | ] 154 | }, 155 | { 156 | "featureType": "road.highway", 157 | "elementType": "geometry.stroke", 158 | "stylers": [ 159 | { 160 | "color": "#a9b8bd" 161 | }, 162 | { 163 | "visibility": "on" 164 | }, 165 | { 166 | "weight": "0.87" 167 | } 168 | ] 169 | }, 170 | { 171 | "featureType": "road.highway.controlled_access", 172 | "elementType": "geometry.fill", 173 | "stylers": [ 174 | { 175 | "gamma": "8.24" 176 | }, 177 | { 178 | "weight": "2.16" 179 | }, 180 | { 181 | "visibility": "on" 182 | } 183 | ] 184 | }, 185 | { 186 | "featureType": "road.arterial", 187 | "elementType": "geometry.fill", 188 | "stylers": [ 189 | { 190 | "weight": "0.22" 191 | }, 192 | { 193 | "visibility": "on" 194 | } 195 | ] 196 | }, 197 | { 198 | "featureType": "road.arterial", 199 | "elementType": "geometry.stroke", 200 | "stylers": [ 201 | { 202 | "color": "#8a0e0e" 203 | } 204 | ] 205 | }, 206 | { 207 | "featureType": "road.local", 208 | "elementType": "all", 209 | "stylers": [ 210 | { 211 | "color": "#f8fbfc" 212 | } 213 | ] 214 | }, 215 | { 216 | "featureType": "road.local", 217 | "elementType": "labels.text", 218 | "stylers": [ 219 | { 220 | "color": "#979a9c" 221 | }, 222 | { 223 | "visibility": "on" 224 | }, 225 | { 226 | "weight": 0.5 227 | } 228 | ] 229 | }, 230 | { 231 | "featureType": "road.local", 232 | "elementType": "labels.text.fill", 233 | "stylers": [ 234 | { 235 | "visibility": "on" 236 | }, 237 | { 238 | "color": "#827e7e" 239 | } 240 | ] 241 | }, 242 | { 243 | "featureType": "road.local", 244 | "elementType": "labels.text.stroke", 245 | "stylers": [ 246 | { 247 | "color": "#3b3c3c" 248 | }, 249 | { 250 | "visibility": "off" 251 | } 252 | ] 253 | }, 254 | { 255 | "featureType": "transit.line", 256 | "elementType": "geometry.stroke", 257 | "stylers": [ 258 | { 259 | "weight": "5.39" 260 | } 261 | ] 262 | }, 263 | { 264 | "featureType": "water", 265 | "elementType": "geometry.fill", 266 | "stylers": [ 267 | { 268 | "color": "#a6cbe3" 269 | }, 270 | { 271 | "visibility": "on" 272 | } 273 | ] 274 | } 275 | ] -------------------------------------------------------------------------------- /TrackingSample/Models/GoogleDirection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace TrackingSample.Models 5 | { 6 | public class GeocodedWaypoint 7 | { 8 | [JsonProperty("geocoder_status")] 9 | public string GeocoderStatus { get; set; } 10 | 11 | [JsonProperty("place_id")] 12 | public string PlaceId { get; set; } 13 | 14 | [JsonProperty("types")] 15 | public IList Types { get; set; } 16 | } 17 | 18 | public class Northeast 19 | { 20 | 21 | [JsonProperty("lat")] 22 | public double Lat { get; set; } 23 | 24 | [JsonProperty("lng")] 25 | public double Lng { get; set; } 26 | } 27 | 28 | public class Southwest 29 | { 30 | 31 | [JsonProperty("lat")] 32 | public double Lat { get; set; } 33 | 34 | [JsonProperty("lng")] 35 | public double Lng { get; set; } 36 | } 37 | 38 | public class Bounds 39 | { 40 | 41 | [JsonProperty("northeast")] 42 | public Northeast Northeast { get; set; } 43 | 44 | [JsonProperty("southwest")] 45 | public Southwest Southwest { get; set; } 46 | } 47 | 48 | public class DistanceOp 49 | { 50 | 51 | [JsonProperty("text")] 52 | public string Text { get; set; } 53 | 54 | [JsonProperty("value")] 55 | public int Value { get; set; } 56 | } 57 | 58 | public class Duration 59 | { 60 | 61 | [JsonProperty("text")] 62 | public string Text { get; set; } 63 | 64 | [JsonProperty("value")] 65 | public int Value { get; set; } 66 | } 67 | 68 | public class EndLocation 69 | { 70 | 71 | [JsonProperty("lat")] 72 | public double Lat { get; set; } 73 | 74 | [JsonProperty("lng")] 75 | public double Lng { get; set; } 76 | } 77 | 78 | public class StartLocation 79 | { 80 | 81 | [JsonProperty("lat")] 82 | public double Lat { get; set; } 83 | 84 | [JsonProperty("lng")] 85 | public double Lng { get; set; } 86 | } 87 | 88 | public class Polyline 89 | { 90 | 91 | [JsonProperty("points")] 92 | public string Points { get; set; } 93 | } 94 | 95 | public class Step 96 | { 97 | 98 | [JsonProperty("distance")] 99 | public DistanceOp Distance { get; set; } 100 | 101 | [JsonProperty("duration")] 102 | public Duration Duration { get; set; } 103 | 104 | [JsonProperty("end_location")] 105 | public EndLocation EndLocation { get; set; } 106 | 107 | [JsonProperty("html_instructions")] 108 | public string HtmlInstructions { get; set; } 109 | 110 | [JsonProperty("polyline")] 111 | public Polyline Polyline { get; set; } 112 | 113 | [JsonProperty("start_location")] 114 | public StartLocation StartLocation { get; set; } 115 | 116 | [JsonProperty("travel_mode")] 117 | public string TravelMode { get; set; } 118 | 119 | [JsonProperty("maneuver")] 120 | public string Maneuver { get; set; } 121 | } 122 | 123 | public class Leg 124 | { 125 | 126 | [JsonProperty("distance")] 127 | public DistanceOp Distance { get; set; } 128 | 129 | [JsonProperty("duration")] 130 | public Duration Duration { get; set; } 131 | 132 | [JsonProperty("end_address")] 133 | public string EndAddress { get; set; } 134 | 135 | [JsonProperty("end_location")] 136 | public EndLocation EndLocation { get; set; } 137 | 138 | [JsonProperty("start_address")] 139 | public string StartAddress { get; set; } 140 | 141 | [JsonProperty("start_location")] 142 | public StartLocation StartLocation { get; set; } 143 | 144 | [JsonProperty("steps")] 145 | public IList Steps { get; set; } 146 | 147 | [JsonProperty("traffic_speed_entry")] 148 | public IList TrafficSpeedEntry { get; set; } 149 | 150 | [JsonProperty("via_waypoint")] 151 | public IList ViaWaypoint { get; set; } 152 | } 153 | 154 | public class OverviewPolyline 155 | { 156 | 157 | [JsonProperty("points")] 158 | public string Points { get; set; } 159 | } 160 | 161 | public class Route 162 | { 163 | 164 | [JsonProperty("bounds")] 165 | public Bounds Bounds { get; set; } 166 | 167 | [JsonProperty("copyrights")] 168 | public string Copyrights { get; set; } 169 | 170 | [JsonProperty("legs")] 171 | public IList Legs { get; set; } 172 | 173 | [JsonProperty("overview_polyline")] 174 | public OverviewPolyline OverviewPolyline { get; set; } 175 | 176 | [JsonProperty("summary")] 177 | public string Summary { get; set; } 178 | 179 | [JsonProperty("warnings")] 180 | public IList Warnings { get; set; } 181 | 182 | [JsonProperty("waypoint_order")] 183 | public IList WaypointOrder { get; set; } 184 | } 185 | 186 | public class GoogleDirection 187 | { 188 | 189 | [JsonProperty("geocoded_waypoints")] 190 | public IList GeocodedWaypoints { get; set; } 191 | 192 | [JsonProperty("routes")] 193 | public IList Routes { get; set; } 194 | 195 | [JsonProperty("status")] 196 | public string Status { get; set; } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /TrackingSample/Models/GooglePlace.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json.Linq; 3 | 4 | namespace TrackingSample.Models 5 | { 6 | public class GooglePlace 7 | { 8 | public string Name { get; set; } 9 | public double Latitude { get; set; } 10 | public double Longitude { get; set; } 11 | public string Raw { get; set; } 12 | 13 | public GooglePlace(JObject jsonObject) 14 | { 15 | Name = (string)jsonObject["result"]["name"]; 16 | Latitude = (double)jsonObject["result"]["geometry"]["location"]["lat"]; 17 | Longitude = (double)jsonObject["result"]["geometry"]["location"]["lng"]; 18 | Raw = jsonObject.ToString(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TrackingSample/Models/GooglePlaceAutoCompletePrediction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | 5 | namespace TrackingSample.Models 6 | { 7 | public class GooglePlaceAutoCompletePrediction 8 | { 9 | [JsonProperty("description")] 10 | public string Description { get; set; } 11 | 12 | [JsonProperty("id")] 13 | public string Id { get; set; } 14 | 15 | [JsonProperty("place_id")] 16 | public string PlaceId { get; set; } 17 | 18 | [JsonProperty("reference")] 19 | public string Reference { get; set; } 20 | 21 | [JsonProperty("structured_formatting")] 22 | public StructuredFormatting StructuredFormatting { get; set; } 23 | 24 | } 25 | 26 | public class StructuredFormatting 27 | { 28 | [JsonProperty("main_text")] 29 | public string MainText { get; set; } 30 | 31 | [JsonProperty("secondary_text")] 32 | public string SecondaryText { get; set; } 33 | } 34 | 35 | public class GooglePlaceAutoCompleteResult 36 | { 37 | [JsonProperty("status")] 38 | public string Status { get; set; } 39 | 40 | [JsonProperty("predictions")] 41 | public List AutoCompletePlaces { get; set; } 42 | } 43 | } -------------------------------------------------------------------------------- /TrackingSample/Services/GoogleMapsApiService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using System.Net.Http.Headers; 4 | using System.Threading.Tasks; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Linq; 7 | using TrackingSample.Models; 8 | 9 | namespace TrackingSample.Services 10 | { 11 | public class GoogleMapsApiService : IGoogleMapsApiService 12 | { 13 | static string _googleMapsKey; 14 | 15 | private const string ApiBaseAddress = "https://maps.googleapis.com/maps/"; 16 | private HttpClient CreateClient() 17 | { 18 | var httpClient = new HttpClient 19 | { 20 | BaseAddress = new Uri(ApiBaseAddress) 21 | }; 22 | 23 | httpClient.DefaultRequestHeaders.Accept.Clear(); 24 | httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 25 | 26 | return httpClient; 27 | } 28 | public static void Initialize(string googleMapsKey) 29 | { 30 | _googleMapsKey = googleMapsKey; 31 | } 32 | 33 | public async Task GetDirections(string originLatitude, string originLongitude, string destinationLatitude, string destinationLongitude) 34 | { 35 | GoogleDirection googleDirection = new GoogleDirection(); 36 | 37 | using (var httpClient = CreateClient()) 38 | { 39 | var response = await httpClient.GetAsync($"api/directions/json?mode=driving&transit_routing_preference=less_driving&origin={originLatitude},{originLongitude}&destination={destinationLatitude},{destinationLongitude}&key={_googleMapsKey}").ConfigureAwait(false); 40 | if (response.IsSuccessStatusCode) 41 | { 42 | var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); 43 | if (!string.IsNullOrWhiteSpace(json)) 44 | { 45 | googleDirection = await Task.Run(() => 46 | JsonConvert.DeserializeObject(json) 47 | ).ConfigureAwait(false); 48 | 49 | } 50 | } 51 | } 52 | 53 | return googleDirection; 54 | } 55 | 56 | public async Task GetPlaces(string text) 57 | { 58 | GooglePlaceAutoCompleteResult results = null; 59 | 60 | using (var httpClient = CreateClient()) 61 | { 62 | var response = await httpClient.GetAsync($"api/place/autocomplete/json?input={Uri.EscapeUriString(text)}&key={_googleMapsKey}").ConfigureAwait(false); 63 | if (response.IsSuccessStatusCode) 64 | { 65 | var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); 66 | if (!string.IsNullOrWhiteSpace(json) && json != "ERROR") 67 | { 68 | results = await Task.Run(() => 69 | JsonConvert.DeserializeObject(json) 70 | ).ConfigureAwait(false); 71 | 72 | } 73 | } 74 | } 75 | 76 | return results; 77 | } 78 | 79 | public async Task GetPlaceDetails(string placeId) 80 | { 81 | GooglePlace result = null; 82 | using (var httpClient = CreateClient()) 83 | { 84 | var response = await httpClient.GetAsync($"api/place/details/json?placeid={Uri.EscapeUriString(placeId)}&key={_googleMapsKey}").ConfigureAwait(false); 85 | if (response.IsSuccessStatusCode) 86 | { 87 | var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); 88 | if (!string.IsNullOrWhiteSpace(json) && json != "ERROR") 89 | { 90 | result = new GooglePlace(JObject.Parse(json)); 91 | } 92 | } 93 | } 94 | 95 | return result; 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /TrackingSample/Services/IGoogleMapsApiService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using TrackingSample.Models; 3 | 4 | namespace TrackingSample.Services 5 | { 6 | public interface IGoogleMapsApiService 7 | { 8 | Task GetDirections(string originLatitude, string originLongitude, string destinationLatitude, string destinationLongitude); 9 | Task GetPlaces(string text); 10 | Task GetPlaceDetails(string placeId); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /TrackingSample/TrackingSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | pdbonly 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /TrackingSample/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using System.Windows.Input; 9 | using TrackingSample.Helpers; 10 | using TrackingSample.Models; 11 | using TrackingSample.Services; 12 | using Xamarin.Essentials; 13 | using Xamarin.Forms; 14 | using Xamarin.Forms.GoogleMaps; 15 | 16 | namespace TrackingSample.ViewModels 17 | { 18 | public class MainViewModel : INotifyPropertyChanged 19 | { 20 | public ICommand CalculateRouteCommand { get; set; } 21 | public ICommand UpdatePositionCommand { get; set; } 22 | 23 | public ICommand LoadRouteCommand { get; set; } 24 | public ICommand StopRouteCommand { get; set; } 25 | IGoogleMapsApiService googleMapsApi = new GoogleMapsApiService(); 26 | 27 | public bool HasRouteRunning { get; set; } 28 | string _originLatitud; 29 | string _originLongitud; 30 | string _destinationLatitud; 31 | string _destinationLongitud; 32 | 33 | GooglePlaceAutoCompletePrediction _placeSelected; 34 | public GooglePlaceAutoCompletePrediction PlaceSelected { get 35 | { 36 | return _placeSelected; 37 | } 38 | set 39 | { 40 | _placeSelected = value; 41 | if (_placeSelected != null) 42 | GetPlaceDetailCommand.Execute(_placeSelected); 43 | } 44 | } 45 | public ICommand FocusOriginCommand { get; set; } 46 | public ICommand GetPlacesCommand { get; set; } 47 | public ICommand GetPlaceDetailCommand { get; set; } 48 | 49 | public ObservableCollection Places { get; set; } 50 | public ObservableCollection RecentPlaces { get; set; } = new ObservableCollection(); 51 | 52 | public bool ShowRecentPlaces { get; set; } 53 | bool _isPickupFocused = true; 54 | 55 | string _pickupText; 56 | public string PickupText 57 | { 58 | get 59 | { 60 | return _pickupText; 61 | } 62 | set 63 | { 64 | _pickupText = value; 65 | if (!string.IsNullOrEmpty(_pickupText)) 66 | { 67 | _isPickupFocused = true; 68 | GetPlacesCommand.Execute(_pickupText); 69 | } 70 | } 71 | } 72 | 73 | string _originText; 74 | public string OriginText 75 | { 76 | get 77 | { 78 | return _originText; 79 | } 80 | set 81 | { 82 | _originText = value; 83 | if (!string.IsNullOrEmpty(_originText)) 84 | { 85 | _isPickupFocused = false; 86 | GetPlacesCommand.Execute(_originText); 87 | } 88 | } 89 | } 90 | 91 | public ICommand GetLocationNameCommand { get; set; } 92 | public bool IsRouteNotRunning { get { 93 | return !HasRouteRunning; 94 | } 95 | } 96 | 97 | public MainViewModel() 98 | { 99 | LoadRouteCommand = new Command(async () => await LoadRoute()); 100 | StopRouteCommand = new Command(StopRoute); 101 | GetPlacesCommand = new Command(async (param) => await GetPlacesByName(param)); 102 | GetPlaceDetailCommand = new Command(async (param) => await GetPlacesDetail(param)); 103 | GetLocationNameCommand = new Command(async (param) => await GetLocationName(param)); 104 | } 105 | 106 | public async Task LoadRoute() 107 | { 108 | var positionIndex = 1; 109 | var googleDirection = await googleMapsApi.GetDirections(_originLatitud, _originLongitud, _destinationLatitud, _destinationLongitud); 110 | if(googleDirection.Routes!=null && googleDirection.Routes.Count>0) 111 | { 112 | var positions = (Enumerable.ToList(PolylineHelper.Decode(googleDirection.Routes.First().OverviewPolyline.Points))); 113 | CalculateRouteCommand.Execute(positions); 114 | 115 | HasRouteRunning = true; 116 | 117 | //Location tracking simulation 118 | Device.StartTimer(TimeSpan.FromSeconds(1),() => 119 | { 120 | if(positions.Count>positionIndex && HasRouteRunning) 121 | { 122 | UpdatePositionCommand.Execute(positions[positionIndex]); 123 | positionIndex++; 124 | return true; 125 | } 126 | else 127 | { 128 | return false; 129 | } 130 | }); 131 | } 132 | else 133 | { 134 | await App.Current.MainPage.DisplayAlert(":(", "No route found", "Ok"); 135 | } 136 | 137 | } 138 | public void StopRoute() 139 | { 140 | HasRouteRunning = false; 141 | } 142 | 143 | public async Task GetPlacesByName(string placeText) 144 | { 145 | var places = await googleMapsApi.GetPlaces(placeText); 146 | var placeResult= places.AutoCompletePlaces; 147 | if (placeResult != null && placeResult.Count > 0) 148 | { 149 | Places = new ObservableCollection(placeResult); 150 | } 151 | 152 | ShowRecentPlaces = (placeResult == null || placeResult.Count ==0); 153 | } 154 | 155 | public async Task GetPlacesDetail(GooglePlaceAutoCompletePrediction placeA) 156 | { 157 | var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId); 158 | if (place != null) 159 | { 160 | if (_isPickupFocused) 161 | { 162 | PickupText = place.Name; 163 | _originLatitud = $"{place.Latitude}"; 164 | _originLongitud = $"{place.Longitude}"; 165 | _isPickupFocused = false; 166 | FocusOriginCommand.Execute(null); 167 | } 168 | else 169 | { 170 | _destinationLatitud = $"{place.Latitude}"; 171 | _destinationLongitud = $"{place.Longitude}"; 172 | 173 | RecentPlaces.Add(placeA); 174 | 175 | if (_originLatitud == _destinationLatitud && _originLongitud == _destinationLongitud) 176 | { 177 | await App.Current.MainPage.DisplayAlert("Error", "Origin route should be different than destination route", "Ok"); 178 | } 179 | else 180 | { 181 | LoadRouteCommand.Execute(null); 182 | await App.Current.MainPage.Navigation.PopAsync(false); 183 | CleanFields(); 184 | } 185 | 186 | } 187 | } 188 | } 189 | 190 | void CleanFields() 191 | { 192 | PickupText = OriginText = string.Empty; 193 | ShowRecentPlaces = true; 194 | PlaceSelected = null; 195 | } 196 | 197 | 198 | //Get place 199 | public async Task GetLocationName(Position position) 200 | { 201 | try 202 | { 203 | var placemarks = await Geocoding.GetPlacemarksAsync(position.Latitude, position.Longitude); 204 | var placemark = placemarks?.FirstOrDefault(); 205 | if (placemark != null) 206 | { 207 | PickupText = placemark.FeatureName; 208 | } 209 | else 210 | { 211 | PickupText = string.Empty; 212 | } 213 | } 214 | catch (Exception ex) 215 | { 216 | Debug.WriteLine(ex.ToString()); 217 | } 218 | } 219 | 220 | public event PropertyChangedEventHandler PropertyChanged; 221 | 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /TrackingSample/Views/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 28 | 29 | 35 | 38 | 48 | 49 |