Proximity Events API in HTML5
Request a Demo
Fill out our form and get started
Support Services
Customer support provided 24/7
Start Demo
Click here for more information
Call 020 37715 770
Speak to our trained sales team

Proximity Events API in HTML5

Mobile phones nowadays are so advanced that certain functions are activated by a mere gesture, with touchpads on mobile phones seeming lighter to the touch and sometimes downright predictive.

Although we can attribute such functions to the advancement of hardware technology in the smartphones, it is the software that makes the smartphone react to the gesture as well as create a seemingly light to the touch screen.

In the past, these functions require a separate native app to allow such communication between software and hardware. With the introduction and further development of HTML5 and web standards, web services can now allow communication between software and hardware.

Proximity Events API in HTML5

The Proximity Events API

The proximity events API is responsible for several functions in your phone. One common example is whenever you call someone and place the phone on your ear, the screen automatically turn dark. This function is integrated into your phone to save on battery while you are talking to the person on the other line. How does the proximity Events API work? It’s simple actually, the Proximity events API activates certain functionalities in your phone once the phone is near an object. In the previous example, the object is your ear. The gesture function on your smartphone could also be brought about by the Proximity Events API.

When your hands or fingers are at a predetermined distance to the phone, certain functions are activated. On web services, the Proximity Events API function by detecting any changes between the phone and the object, then it sends it to the browser if the conditions are met specified functions will be activated. Notice that the proximity events API is only available to use on a smartphone for the simple reason that such phones do have sensors which are a very important requirement.

Although some phones do not have the required sensors that proximity event API may still be compatible or accepted by the device. However, the events may not be activated, due to the absence of said sensors.

The Events

The proximity events API defines two events. These events are used to trigger the reaction or listening of the phone. The two events are:

User Proximity - this event functions as a sensing event. This is because it detects whether or not the phone or device is proximate to an object.

Device Proximity - the device proximity event, on the other hand, is responsible for providing information about the distance between the target object and the smartphone. It has three properties whose value could be set by the developer. These properties are value, min, and max. The value refers to the number that will use to represent the distance between the object and the phone. The max and min properties, on the other hand, will provide the maximum and minimum distance that the phone sensor can detect.

Proximity Events API

Hardware Communication

As earlier stated, the Proximity API is used to communicate with a hardware and in this case, the hardware is the sensor built in your smartphone. The proximity sensor in the smartphone is used to detect whatever it is commanded in the Proximity API. However, the hardware has its limitations too. One limitation is that the material composition of an object may interfere with the capability of the sensor to detect. Although the sensor has several limitations pertaining to detecting an object, due to its transparency, chemical composition of the object, reflectiveness among others, it can give a fair estimate of the distance between the phone and the object.

Proximity Events API and HTML5

The proximity events API is used on web services, this is why it is built using the framework of HTML5. Moreover, the defining of a window interface is by way of the HTML5 specification. To be clear about it, the Proximity Events API being a web services API by nature, it needs to be built on using the specifications of HTML5.

HTML5 Proximity Events API

Browser Compatibility

Aside from HTML5, the proximity events API also depend on the functionality of a browser. Unfortunately, since this API is still being improved, it is not compatible with the Chrome browser, which is one of the most widely used browsers. However, it is compatible with the Firefox browser.

Since it is still being developed and perfected, we have to expect that this will change and compatibility with the Chrome browser and any other browser for that matter, will come very soon.
Enterprise Resource Planning
Finance Options
Call 020 37715 770
ERP Sales Open 09:00 until 17:00
Task Manager
Software Tools
ERP Mobile Version
Support
Assets