PATCH https://mybusiness.googleapis.com/v3/123456/locations/ 654321?languageCode=en-US&fieldMask=priceLists { "priceLists": [ { "priceListId": "Breakfast", "labels": [ { "displayName": "Breakfast", "description": "Tasty Google Breakfast", "languageCode": "en-US" } ], "sourceUrl": "http://www.google.com/todays_menu", "sections": [ { "sectionId": "entree_menu", "labels": [ { "displayName": "Entrées", "description": "Breakfast Entrées", "languageCode": "en-US" } ], "items": [ { "itemId": "scramble", "labels": [ { "displayName": "Big Scramble", "description": "A delicious scramble filled with Potatoes, Eggs, Bell Peppers, and Sausage", "languageCode": "en-US" } ], "price": { "currencyCode": "USD", "units": "12", "nanos": "200000000" }, "photoUrls": [ "http://www.google.com/images/breakfast_scramble1.jpg", "http://www.google.com/images/breakfast_scramble2.jpg" ] }, { "itemId": "steak_omelette", "labels": [ { "displayName": "Steak Omelette", "description": "Three egg omelette with grilled prime rib, fire-roasted bell peppers and onions, saut\u00e9ed mushrooms and melted Swiss cheese", "languageCode": "en-US" } ], "price": { "currencyCode": "USD", "units": "15", "nanos": "750000000" } } ] } ] } ] }
POST https://mybusiness.googleapis.com/v3/123456/locations:reportInsights { "locationNames": [ “accounts/110714876951578713336/locations/14372810722634034850”, ], “basicRequest” : { "metricRequests": [ { "metric": QUERIES_DIRECT, }, { "metric": QUERIES_INDIRECT, } ], "timeRange": { "startTime": 2016-10-12T01:01:23.045123456Z, "endTime": 2017-01-10T23:59:59.045123456Z, }, }, }
{ "locationMetrics": [ { "locationName": "accounts/110714876951578713336/locations/ 14372810722634034850", "timeZone": "America/Los_Angeles", "metricValues": [ { "metric": "QUERIES_DIRECT", "totalValue": { "metricOption": "AGGREGATED_TOTAL", "timeDimension": { "timeRange": { "startTime": "2016-10-12T04:00:00Z", "endTime": "2017-01-10T04:00:00Z" } }, "value": "36738" } }, { "metric": "QUERIES_INDIRECT", "totalValue": { "metricOption": "AGGREGATED_TOTAL", "timeDimension": { "timeRange": { "startTime": "2016-10-12T04:00:00Z", "endTime": "2017-01-10T04:00:00Z" } }, "value": "81770" } } ] } ] }
POST https://mybusiness.googleapis.com/v3/123456/locations:reportInsights { “locationNames": [ “accounts/110714876951578713336/locations/14372810722634034850”, ], "drivingDirectionsRequest”: { "numDays": NINETY, }, }
{ "locationDrivingDirectionMetrics": [ { "locationName": "accounts/110714876951578713336/locations/ 14372810722634034850", "topDirectionSources": [ { "dayCount": 90, "regionCounts": [ { "latlng": { "latitude": 37.789, "longitude": -121.392 }, "label": "94105", "count": "2980", }, { "latlng": { "latitude": 37.779, "longitude": -122.421 }, "label": "94102", "count": "887", }, { "latlng": { "latitude": 37.773, "longitude": -122.410 }, "label": "94103", "count": "886", } ] } ], "timeZone": "America/Los_Angeles" } ] }
function initialize() { macaddress.one('wlan0', function (err, mac) { mac_address = mac; if (mac === null) { console.log('exiting due to null mac Address'); process.exit(1); } firebase.initializeApp({ serviceAccount: '/node_app_slot/<service-account-key>.json', databaseURL: 'https://<project-id>.firebaseio.com/' }); var db = firebase.database(); ref_samples = db.ref('/samples'); locationSample(); }); }
function locationSample() { var t = new Date(); iwlist.scan('wlan0', function(err, networks) { if(err === null) { ref_samples.push({ mac: mac_address, t_usec: t.getTime(), t_locale_string: t.toLocaleString(), networks: networks, }); } else { console.log(err); } }); setTimeout(locationSample, 10000); }
private void GeolocateWifiSample(DataSnapshot sample, Firebase db_geolocations, Firebase db_errors) { // initalize the context and request GeoApiContext context = new GeoApiContext(new GaeRequestHandler()).setApiKey(""); GeolocationApiRequest request = GeolocationApi.newRequest(context) .ConsiderIp(false); // for every network that was reported in this sample... for (DataSnapshot wap : sample.child("networks").getChildren()) { // extract the network data from the database so it’s easier to work with String wapMac = wap.child("address").getValue(String.class); int wapSignalToNoise = wap.child("quality").getValue(int.class); int wapStrength = wap.child("signal").getValue(int.class); // include this network in our request request.AddWifiAccessPoint(new WifiAccessPoint.WifiAccessPointBuilder() .MacAddress(wapMac) .SignalStrength(wapStrength) .SignalToNoiseRatio(wapSignalToNoise) .createWifiAccessPoint()); } ... try { // call the api GeolocationResult result = request.CreatePayload().await(); ... // write results to the database and remove the original sample } catch (final NotFoundException e) { ... } catch (final Throwable e) { ... } }
ChildEventListener samplesListener = new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) { // geolocate and write to new location GeolocateWifiSample(dataSnapshot, db_geolocations, db_errors); } ... }; db_samples.addChildEventListener(samplesListener);
function initMap() { // attach listeners firebase.database().ref('/visualization').on('child_added', function(data) { ... data.ref.on('child_added', function(vizData) { circles[vizData.key]= new CircleRoyale(map, vizData.val().lat, vizData.val().lng, vizData.val().accuracy, color); set_latest_position(data.key, vizData.val().lat, vizData.val().lng); }); data.ref.on('child_removed', function(data) { circles[data.key].removeFromMap(); }); }); // create the map map = new google.maps.Map(document.getElementById('map'), { center: get_next_device(), zoom: 20, scaleControl: true, }); ... }
Give us feedback in our Product Forums.