Today I will tell you about the application that was created in Arcadia for the convenience of booking meeting rooms.

There are two main scenarios for using this application:
')
1. Search for free roomA lot of meetings are held in the company every day; managers, developers and employees of the HR department reserve negotiations. Finding a meeting room can be quite a long and routine exercise. To understand which room is currently free, you need to go to the Outlook calendar (or open the door, distracting the attention of the meeting participants), view the full schedule by room, find an empty time slot and create an appointment. During this time, someone from the staff can book a room, and then you need to start the search again. It is much more convenient to make a reservation by pressing a single button using the application, having received prompts about the status of rooms in advance.
2. Ad hoc bookingQuite often there is a situation when you need to gather for 15 minutes to briefly discuss the current project tasks. In this case, it makes no sense to occupy a room for a whole hour, but there may not be free slots for the selected time. But if it remains at least 10 minutes before the next rally, the application will allow you to book a room, and for a short meeting this may be quite enough. Also sometimes there is a situation when the room was booked for a long time, for example, 2 hours, but the rally ended earlier. In this case, at the end of the rally, you can click on the cancel button and empty the room.
Choosing a platform to solve
Android was originally chosen as the operating system, since it supports customization (including on-off on schedule, autorun applications), and a large number of device models are on sale.
It was considered several options. As an information board, there is no need to choose a top tablet model: a separate device is required for each room, and as the price of one tablet rises, the cost of the final solution increases significantly. But at the same time, it is impossible to take the cheapest devices - they have a weak, "muddy" IPS matrix, low resolution, outdated OS version, and such a solution would look very unpresentable. As a result, we made a choice in favor of the Alcatel OneTouch Pixi 3 (10) 3G - a tablet with quite average characteristics: 1280x800 TFT IPS, Android 5.1, 1 GB RAM, MediaTek MT8321 1300 MHz processor, in which the 3G module goes in addition for a fairly reasonable price - about 8 thousand rubles (currently the cost of the device is lower).
To lock the hardware keys and screen system elements, we ordered a black Plexiglas housing. The housing acts as a protective cover and mounting the device on the wall and has holes for installation. At the moment, there are 5 tablets installed at the entrance to each of the meeting rooms. Our conversations are named after classic programming languages: Cobol, Prolog, Fortran, Ada, Pascal, each has its own icon that is displayed on the screen next to the room number.

The application allows you to book a room (create an appointment) for a specified period of time: 15, 30, 45 minutes, as well as 1, 1.5, 2 hours. If the user chooses to choose an interval of 2 hours, and the room is free only a fraction of this time, then the reservation will be offered, taking into account restrictions. The bottom panel of the application displays the current statuses of other meeting rooms: red - the room is busy, green - free, and gray if you have problems getting status (for example, a failure occurred while requesting status).
Key application functionality and wow factor is face recognition using the
Microsoft Face API . Each time you make a reservation using the front camera, a snapshot of the user is created, which is used to match the previously processed list of photos of employees from Exchange. If the user was successfully recognized, the name of the reservation is indicated in the reservation name, i.e. you do not need to manually enter the author of the rally, which saves time. Recognition is affected by the lighting of the room, and most importantly - the original photo of the user, loaded as an avatar.
Development and Planning
At the planning stage of development, the question arose which of the existing access solutions could be used to book rooms and get statuses - the Office 365 Android SDK or EWS API. As it turned out, the functionality of the
EWS Java API adapted for Android (the
official version of the EWS Java API ) is more universal and allows you to connect to both the cloud version and the local Exchange.
Initially, the company set up an on-premises Exchange, but our IT specialists were just planning to migrate to Office 365 Exchange Online, so the task was to use the most versatile solution so that the transition would not lead to a significant change in the code. Migrating to the cloud API required changing the accounts in the application and changing the URL (setUrl method of the ExchangeService class): On-premises Exchange requires the base URL
https: //mail.DOMAIN/EWS/Exchange.asmx , where DOMAIN is the company's domain name, and for Office 365 Exchange Online -
https://outlook.office365.com/EWS/Exchange.asmx . (manual configuration is required if Autodiscover does not work)
Integration features
When integrating the EWS API, there were difficulties due to the fact that the library was written primarily for Java SE and pulls the outdated Apache Http Client and DNS client (unlike the Office 365 SDK, which is built on a more modern architecture).
The problem with the Apache Http Client was solved by adding a line to the defaultConfig build.gradle of the application module:
useLibrary 'org.apache.http.legacy'
Client support has been removed since Android SDK 23 (6.0), therefore at this time this setting is required for all legacy libraries using the apache client. As a DNS client, the minimalistic
MiniDNS (minidns-core) was perfect.
Calls to the API are most conveniently wrapped using RxJava, since they are processed synchronously and block the UI stream. For example (RxJava 1):
Observable.create(new Observable.OnSubscribe<Boolean>() { @Override public void call(Subscriber<? super Boolean> subscriber) {
If the room was booked using the app, you can cancel the reservation or extend it. In the case of extension, the user will be offered the maximum available time. To cancel reservations made under the user's personal account, use the desktop or mobile version of Outlook.

If the user who created the current rally has an avatar installed, it will be displayed by clicking on the room icon. Photos are stored at (for Office 365 Exchange Online):
https://outlook.office365.com/EWS/Exchange.asmx/s/GetUserPhoto?email=EMAIL&size=SIZEWhere EMAIL is the user's email address, and SIZE is the size of the photo, for example, HR96x96. More information can be found on the
MSDN page.
When setting up accounts for rooms there is one important feature. There should be two types of accounts - one to get information about the status of all rooms (with full rights) and the second to book. If you make a reservation using the admin account, the appointment may be created on top of existing ones, this must be remembered so that there is no confusion.
To simplify the installation of future updates, devices are configured to receive Firebase Push Notifications. When creating a push message, you can specify a specific device (room number) or all devices to update simultaneously. As soon as the notification arrives, the download of the installation package (APK) from the company's internal FTPS server begins. Android security restrictions require manual confirmation of the installation, but usually this process does not take more than a couple of minutes.
You may have noticed the QR code next to the room icon. It is made for receiving feedback, you can open the link on your mobile device and leave feedback about the application if you have any problems with the use.

Problems and solutions
As it turned out, it is rather difficult to negotiate with the business center about connecting electricity to installed tablets (there are no outlets on the walls and under the ceiling), so it was decided to make power based on compact 18 Ah lithium batteries (power bank). To save energy, the tablets are set to turn off at 20:00 and turn on daily at 8:00 on weekdays, which allows for less frequent battery changes.
Our sysadmins set up a separate Wi-Fi network for devices and turned on filtering by IP addresses (Cisco’s software does not have URL filtering) for security. Unfortunately, it was not possible to use familiar tools, such as Fabric Crashlytics, for tracking errors, since IP addresses periodically changed, but it was possible to open access to Firebase without problems (which allows using push notifications and storing logs in a database) and Azure Cloud (Microsoft Face API).
At the moment, our solution for booking rooms is actively used, the tablets are synchronized daily for one and a half years. After initial debugging and testing of the application, no problems were found, except for one bug with updating the data on the screen, which was decided to clear the application cache. Customers visiting our office show interest in the product and appreciate its convenience. In the future we plan to add additional logging in Firebase, as well as the possibility of notifications by mail to inform about the status of the charge (the need to change the Powerbank).