Maintaining a staff and staying aware of their needs is one of the main functions of management. At all levels of a company, managers need to keep track and be aware of employee needs, for many reasons, they’re responsible for them and their work. Even such trivial things such as tracking work time are very important for company’s culture and help improve team flow. So in this tutorial, we are going to guide to track Attendance with Beacon. Example Tutorial will work on any Android platform without any error.
First of all, we would like to discuss little Beacons.
Beacon :
A beacon is a small Bluetooth radio transmitter. It’s kind of like a lighthouse: it repeatedly transmits a single signal that other devices can see. Instead of emitting visible light, though, it broadcasts a radio signal that is made up of a combination of letters and numbers transmitted on a regular interval of approximately 1/10th of a second. A Bluetooth-equipped device like a smartphone can “see” a beacon once it’s in range, much like sailors looking for a lighthouse to know where they are.
Below is the code snippet to search the Bluetooth devices. Here we use the Bluetooth library to scan the nearby devices and perform the logic. Here we use rssi to get the distance of the device. By using the rssi we perform our logic.
private BluetoothClient mClient; private List<SearchResult> mDevices; mDevices = new ArrayList<SearchResult>(); mClient = new BluetoothClient(context); private void searchDevice() { SearchRequest request = new SearchRequest.Builder() .searchBluetoothLeDevice(3000, 3) .searchBluetoothClassicDevice(5000) .searchBluetoothLeDevice(5000) .build(); ClientManager.getClient().search(request, mSearchResponse); } private final SearchResponse mSearchResponse = new SearchResponse() { @Override public void onSearchStarted() { BluetoothLog.w("MainActivity.onSearchStarted"); mDevices.clear(); } @Override public void onDeviceFounded(final SearchResult device) { // BluetoothLog.w("MainActivity.onDeviceFounded " + device.device.getAddress()); if (!mDevices.contains(device)) { mDevices.add(device); Beacon beacon = new Beacon(device.scanRecord); BluetoothLog.v(String.format("beacon for %sn%s", device.getAddress(), beacon.toString())); Log.d("MainActivity","beacon for" +device.getAddress() + " and name "+device.getName() + " and beacon "+beacon.toString() + " and rssi "+device.rssi) Date d = new Date(); DateFormat datenew = new SimpleDateFormat("MM/dd/yyyy"); DateFormat timenew = new SimpleDateFormat("hh:mm:ss a"); Log.d("timeAndDatewithformat", datenew.format(d) + " and "+timenew.format(d)); if(device.rssi >= -80){ //Your Object to send data Log.d("MainActivity","rssi value in if "+device.rssi); } else { //Your Object to send data Log.d("MainActivity","rssi value in else "+device.rssi); } mClient.connect(device.getAddress(), new BleConnectResponse() { @Override public void onResponse(int code, BleGattProfile data) { if (code == REQUEST_SUCCESS ) { Log.d("FFFFF", data.toString()); //mClient.disconnect(device.getAddress()); } } }); } } @Override public void onSearchStopped() { BluetoothLog.w("MainActivity.onSearchStopped"); for (SearchResult device:mDevices) { Log.d("Address",device.getAddress()); Log.d("Name",device.getName()); } } @Override public void onSearchCanceled() { BluetoothLog.w("MainActivity.onSearchCanceled"); } };
By using this code you can easily track the timing of the employee in your organization. Above code snippet will search the nearby Bluetooth device for your app and by using the RSSI of device you can easily calculate the check-in and check-out time of your employee.
In the world of IoT services, sensors to track human activities and many other things are considered as a vital element and smart devices are actively used as a means to collect and process information from the sensors. The wireless communication and NFC provided by the smartphones are especially the key technologies for exchanging information among participants of IoT service. Beacon implementation is championing this new paradigm for mobile communication. BLE is a major overhaul of the existing Bluetooth protocol. BLE is aimed at very low power applications where battery replacement or maintenance is not required to be attended to for an extended period.
Conclusion
There is another option that you might not be aware of in the form of a new technology that is rapidly establishing itself as the go-to solution for many business environments. I’m referring to beacons, which are electronic devices that set up local wireless data networks to create what are called “proximity-based solutions”.
Most often, references to beacons in the media or industry publications focus on how they are used to enhance retail sales or deliver contextual content but these are only two of their more well-known applications. If you’re not familiar with the broader capabilities of beacons, now is a good time to take a look at what they can do for you and, in particular, how they can assist in your employee time tracking.