Using the location sensor with App Inventor Level

  • Slides: 8
Download presentation
Using the location sensor with App Inventor Level 2 Display locations on map, Zoom

Using the location sensor with App Inventor Level 2 Display locations on map, Zoom and unzoom, Tune time and distance intervals. Mobile CSP 2016 Pierre Huguet pierre. huguet 50@gmail. com

Level 2 addons • Level 2 adds : Location display on map Ø new

Level 2 addons • Level 2 adds : Location display on map Ø new canvas component with map URL (Google static maps API) Ø new button & handler to toggle List - Map displays Ø new functions (procedures) to display map and switch display Zoom or unzoom map around current location Ø 2 new buttons & handlers to zoom/unzoom – Change of location sensor time and distance intervals Ø new vertical and horizontal arrangements to hold menus Ø new textboxes to display & update values (numbers only) Ø new buttons and event handlers to update or cancel Note : Map display is better described in the mapping tutorial 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

New components for level 2 Time and Distance settings Map canvas New Map/List display

New components for level 2 Time and Distance settings Map canvas New Map/List display toggle and zoom buttons 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

Modified blocks for level 2 (1/4) initialize and display functions Add blocks to set

Modified blocks for level 2 (1/4) initialize and display functions Add blocks to set visibility of new components at startup. var. Settings for time and space intervals (non visible). map. Canvas for map display (non visible) (this may be skipped if set in designer) Update the display function : if the Map. Canvas is visible. (new function) instead of … In the display. Track. List function, add : block to set the Map. Canvas invisible block to change the displat toggle icon 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

New blocks for level 2 (2/4) display toggle and zoom Add event handler to

New blocks for level 2 (2/4) display toggle and zoom Add event handler to toggle between list and map display (when clicking on the display toggle button) it calls to 2 new functions which will switch components visibility accordingly, then call the appropriate display function or Add map zoom variable Add zoom and unzoom event handlers to increment/decrement zoom, then call map display 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

New blocks for level 2 (3/4) new map display function • This function follows

New blocks for level 2 (3/4) new map display function • This function follows the "static map API" (see mapping tutorial for details) cf. https: //developers. google. com/maps/documentation/static-maps/ set icon and components visibility base url for static maps set map center (latitude and longitude) set map size to canvas size set zoom factor set map type (roadmap) display marker at last location add track coordinates to display set canvas image to map URL alternate display if no location 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

New blocks for level 2 (4/4) new button handler to set time and distance

New blocks for level 2 (4/4) new button handler to set time and distance intervals • New button handler to open/close the menu to modify the location time and distance intervals New button handler to update the location time and distance intervals from values in textbox Check values not empty Check reasonable values New cancel/exit handler 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com

Level 2 : blocks overview 07/2016 Location and GPS tutorial for App Inventor, pierre.

Level 2 : blocks overview 07/2016 Location and GPS tutorial for App Inventor, pierre. huguet 50@gmail. com