Microcamtest

checking the microphone and webcam

Google Discontinues Google Maps Click to Call

Prerequisites

Knowledge of the following:

  • How to create a basic Android app and run it using Android Studio.
  • How to create and manage resources, such as strings.
  • How to refactor code and rename variables using Android Studio.
  • How to use a Google map as a user.
  • How to set runtime permissions.

Changing the Map Type

Depending on the functionality of your app, the normal map view might not be detailed enough for you. The Android Maps API provides different map types to help you out: MAP_TYPE_NORMAL, MAP_TYPE_SATELLITE, MAP_TYPE_TERRAIN, MAP_TYPE_HYBRID

Add the following inside setUpMap() just below the setMyLocationEnabled() call:

GoogleMap.MAP_TYPE_TERRAIN displays a more detailed view of the area, showing changes in elevation:

GoogleMap.MAP_TYPE_NORMAL displays a typical road map with labels. This is default type. Here’s what the other types look like:

GoogleMap.MAP_TYPE_SATELLITE displays a satellite view of an area with no labels:

GoogleMap.MAP_TYPE_HYBRID displays a combination of the satellite and normal mode:

Video

Add menu for map types

In this step, you add an app bar with an options menu that allows the user to change the map type.

  1. To create a new menu XML file, right-click your res directory and select New > Android Resource File.
  2. In the dialog, name the file map_options.
  3. Choose Menu for the resource type.
  4. Click OK.
  5. In the Code tab, replace the code in the new file with the following code to create the map menu options. The "none" map type is omitted because "none" results in the lack of any map at all. This step causes an error, but you resolve it in the next step.
  1. In strings.xml, add resources for the title attributes in order to resolve the errors.
  1. In MapsActivity, override the onCreateOptionsMenu() method and inflate the menu from the map_options resource file.
  1. In MapsActivity.kt, override the onOptionsItemSelected() method. Change the map type using map-type constants to reflect the user's selection.
  1. Run the app.
  2. Click to change the map type. Notice how the map's appearance changes between the different modes.

Open an InfoWindow When Clicking on The Marker

Click on the marker to show an infowindow with some text:

Example

var infowindow = new Window({   content:"Hello World!" }); google.maps.event.addListener(marker, ‘click’, function() {   infowindow.open(map,marker); });

Accessing Arguments in UI Events

UI events within the Maps JavaScript API typically pass an event argument, which can be accessed by the event listener, noting the UI state when the event occurred. For example, a UI 'click' event typically passes a MouseEvent containing a latLng property denoting the clicked location on the map. Note that this behavior is unique to UI events; MVC state changes do not pass arguments in their events.

You can access the event’s arguments within an event listener the same way you would access an object’s properties. The following example adds an event listener for the map, and creates a marker when the user clicks on the map at the clicked location.

TypeScript

JavaScript

View example function initMap() { const map = new google.maps.Map(document.getElementById("map"), { zoom: 4, center: { lat: -25.363882, lng: 131.044922 }, }); map.addListener("click", (e) => { placeMarkerAndPanTo(e.latLng, map); }); } function placeMarkerAndPanTo(latLng, map) { new google.maps.Marker({ position: latLng, map: map, }); map.panTo(latLng); } /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; }

<!DOCTYPE html> <html> <head> <title>Accessing Arguments in UI Events</title> <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> <!– jsFiddle will insert css and js –> </head> <body> <div id="map"></div> <!– Async script executes immediately and must be after any DOM elements used in callback. –> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly&channel=2" async ></script> </body> </html>

Getting Current Location

One of the most common uses for location services is finding the user’s current location. You do this by requesting the last known location of the user’s device from the Google Play services location APIs.

In MapsActivity.kt, add the following new property:

Next, remove the code in onMapReady() that put a marker in New York:

Add the code below to the bottom of setUpMap():

Taking each commented section in turn:

  1. isMyLocationEnabled = true enables the my-location layer which draws a light blue dot on the user’s location. It also adds a button to the map that, when tapped, centers the map on the user’s location.
  2. fusedLocationClient.getLastLocation() gives you the most recent location currently available.
  3. If you were able to retrieve the the most recent location, then move the camera to the user’s current location.

Build and run to view your progress so far. You’ll see a light blue dot on the user’s location:

Emulator Testing

It’s best to use a real Android device to test a map application. If for some reason, you need to test from an emulator, you can do so by mocking location data in the emulator.

One way to do this is by using the emulator’s extended controls. Here’s how you’d do that:

  1. Start the emulator. On the right hand panel, click the more icon () to access the Extended Controls.
  2. Select the Location item on the left hand side of the Extended Controls dialog.
  3. Enter the latitude and longitude values in the specified fields and click Send.

Getting and Setting Properties within Event Handlers

None of the MVC state change events in the Maps JavaScript API event system pass arguments when the event is triggered. (User events do pass arguments which can be inspected.) If you need to inspect a property on an MVC state change, you should explicitly call the appropriate getProperty() method on that object. This inspection will always retrieve the current state of the MVC object, which may not be the state when the event was first fired.

Note: Explicitly setting a property within an event handler which responds to a state change of that particular property may produce unpredictable and/or unwanted behavior. Setting such a property will trigger a new event, for example, and if you always set a property within this event handler, you may end up creating an infinite loop.

In the example below, we set up an event handler to respond to zoom events by bringing up an info window displaying that level.

TypeScript

JavaScript

View example function initMap() { const originalMapCenter = new google.maps.LatLng(-25.363882, 131.044922); const map = new google.maps.Map(document.getElementById("map"), { zoom: 4, center: originalMapCenter, }); const infowindow = new Window({ content: "Change the zoom level", position: originalMapCenter, }); infowindow.open(map); map.addListener("zoom_changed", () => { infowindow.setContent("Zoom: " + map.getZoom()); }); } /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; }

<!DOCTYPE html> <html> <head> <title>Getting Properties With Event Handlers</title> <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> <!– jsFiddle will insert css and js –> </head> <body> <div id="map"></div> <!– Async script executes immediately and must be after any DOM elements used in callback. –> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly&channel=2" async ></script> </body> </html>

What are the benefits of click to call ads?

Industries that are well suited to click-to-call ads can benefit from them in many ways. Some of the most important benefits of these ads include:

They improve conversion rates

A company’s number of conversions generally decreases if their website or ad doesn’t display the business’s phone number. In fact, a recent Quick Sprout study showed that adding a click-to-call ad resulted in a 400 percent increase in call-to-conversion rate. On top of this, click-to-call ads give your business the chance to upsell consumers on the phone. Why do click-to-call ads have such a dramatic effect on conversion rates? Well, consider this. When users click-to-call on your mobile ad, they’re already thinking about buying your product, which means they’re pretty far down the sales funnel. In many cases, talking to a sales or customer service representative is just what you need to win them over.

They give you an edge over your competitors

A recent Google study of 3000 mobile searchers found that 95 percent of small-to-medium sized businesses do not use click-to-call features. But nearly half of these mobile searchers said they would search somewhere else if click-to-call features were not present. This means that not having these features can significantly harm your business’s sales. In addition, 70 percent of mobile searchers use click-to-call and consider calls to be an important channel for consumers. The study also found that 61 percent of the searchers considered click-to-call to be “Extremely or Very Important” when deciding to make a purchase, and that 47 percent described feeling “frustrated,” annoyed,” or “more likely to explore other brands” when they were not able to directly call the business.

They make it easier for prospective customers to get in touch with you

With click-to-call ads, the phone number is placed at the top of the page with the word “Call”, and the call button is displayed right next to the copy. This means the phone number is in a very prominent location, which makes it easy for prospects to see it and take action. Click-to-call ads also simplify the process of getting in touch with you. Instead of sending customers to a landing page with a phone number, all they have to do is tap on a click-to-call ad to call your business. This helps motivate prospects to take action and can move them down the sales funnel more quickly.

More Apps

Instagram Feed Add posts from your Instagram account or by hashtag to your website Bestseller Google Reviews Embed reviews on your place from Google right on your site Bestseller WhatsApp Chat Give users an opportunity to contact you on WhatsApp straight from your website Bestseller

Tags