Advancements in protocols, computing paradigms, and electronics have enabled the development of wireless sensor networks (WSNs) with high potential for various location-based applications in different fields. One of the most important topics in WSNs is the localization in environments with sensor nodes being scattered randomly over a region. Localization techniques are often challenged by localization latency, efficient energy consumption, accuracy, environmental factors, and others. The objective of this study was to improve the technique for detecting the nearest Bluetooth Low Energy sensor, which would enable the development of more efficient mobile applications for location advertising at fairs, exhibitions, and museums. The technique proposed in this study was based on the iBeacon protocol, and it was tested in a controlled room with three environmental settings regarding the density of obstacles, as well as in a real-world setting at the Expo Museum at Postojna in Slovenia. The results of several independent measures, conducted in the controlled room and in the real-world environment, showed that the proposed algorithm outperformed the standard algorithm, especially in the environments with a medium or high densities of obstacles. The results of this study can be used for the more effective planning of placing beacons in space and for optimizing the algorithms for detecting transmitters in mobile location-based applications that provide users with contextual information based on their current location.