Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small...

27
WINTER 2016

Transcript of Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small...

Page 1: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

IN DEGREE PROJECT COMPUTER ENGINEERING,FIRST CYCLE, 15 CREDITS

, STOCKHOLM SWEDEN 2017

Beacons for online advertisingAn approach using a plugin

ALBIN FRIEDNER

ALEXANDER NIKALAYEU

KTH ROYAL INSTITUTE OF TECHNOLOGYSCHOOL OF INFORMATION AND COMMUNICATION TECHNOLOGY

Page 2: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies
Page 3: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

Abstract

Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies using low power consumption. Beacons technology started to emerge lately and many companies has started to see opportunities. One usage of beacons is improving online advertising by using localized information. The most common way to consume beacons today, is by using a native application. This solution is viable in many cases, but not for online advertising. The reason for this is that users do not want to download a native application only for advertising. In this study, solutions for online advertising using beacons, are examined. The study is focused around a case study on implementing a plugin for Android applications. The plugin consists of a background service that listens for beacon messages, converts the beacon messages to geographic information and gathers user information. All that information is sent to a web service to later perform retargeting. This improves online advertisement, since localized advertisement can be displayed to the user. The results of the case study showed that the plugin is a viable solution for online advertising using beacons. The plugin could be integrated and launched from different Android applications in a simple way. Measurements of the RAM usage and battery consumption indicates that the plugin can run with no huge impact on the performance or battery of the phone. The purpose of the study is to present different ways of using beacons for online advertising. Keywords Beacons, Android, Plugins, Bluetooth, Retargeting, Physical Web

Page 4: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

Abstract

Beacons är små enheter som kan sända ut meddelanden genom att använda Bluetooth eller andra kommunikationstekniker med låg energiförbrukning. Teknologin bakom Beacons började framträda nyligen och många företag har redan sett de möjligheter som finns med teknologin. Beacons kan bland annat användas till att förbättra digital reklam genom att använda lokaliserad information. Det vanligaste sättet att konsumera beacons är att använda en lokal applikation. Det sättet är användbart i många fall, men inte för digital reklam. Anledningen till det är att användare tenderar att inte vilja ladda ner applikationer endast för att få reklam. I den här studien undersöks lösningar för att använda beacons för digital reklam. Studien fokuserar kring en fallstudie om ett insticksprogram till applikationer för Android. Insticksprogrammet består av en bakgrundstjänst som lyssnar efter meddelande från beacons, konverterar meddelandet till geografisk information, samlar information om användaren och skickar informationen till en web service, som senare använder informationen för att ge användare anpassad reklam. Detta förbättrar reklamen, eftersom användarens position kan användas för att ge bättre anpassad reklam. Resultaten från fallstudien visar att insticksprogrammet är en genomförbar lösning för att använda beacons för digital reklam. Insticksprogrammet kan integreras och startas från en applikation i Android på ett enkelt sätt. Mätningar av insticksprogrammets RAM-användning och batterianvändning visar på att det kan köras utan att märkbart påverka telefonens prestanda eller batteri. Syftet med den här studien är att visa olika sätt som beacons kan användas för digital reklam. Nyckelord Beacons, Android, Insticksprogram, Bluetooth

Page 5: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

Table of Contents

1 INTRODUCTION 1

1.1 Background 1

1.2 Problem 2

1.3 Purpose 2

1.4 Delimitations 2

1.5 Outline 3

2 THEORETIC BACKGROUND 5

2.1 Beacons 5

2.1.1 Bluetooth technology 5

2.1.2 Power usage and range 6

2.1.3 Communication protocols 6

2.1.4 iBeacon 7

2.1.5 Eddystone 7

2.1.6 Estimote protocols and tools 9

2.1.6.1 Fleet management API 9

2.1.6.2 Here & Now 9

2.1.6.3 Nearable 9

2.1.6.4 Other protocols and tools 9

2.1.7 Common usages 10

2.2 Android 10

2.2.1 Android Applications 10

2.2.2 Estimote SDK for Android 11

2.2.2.1 Estimote Connection 11

2.2.2.2 Estimote Location 11

2.2.2.3 Estimote Telemetry 12

2.2.3 Plugins and libraries 12

2.3 Online advertising 12

2.4 Data Management Platform 13

2.5 Earlier work 13

2.6 Summary 14

2.7 Sources and related works 15

3 METHOD 17

3.1 Research methods 17

3.1.1 Qualitative and quantitative research methods 17

Page 6: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

3.1.2 Inductive and deductive approach 17

3.1.3 Chosen research method 17

3.1.4 Process overview 17

3.2 Data collection methods 18

3.2.1 Company information 18

3.2.2 Literature study 18

3.3 Analysis process 19

3.4 Implementation process 20

3.5 Evaluation methods 21

3.5.1 Non-functional requirements 21

3.5.2 Functional requirements 22

3.6 Project method and software development tools 22

3.6.1 Project method 22

3.6.2 Development environment 23

4 ANALYSIS 25

4.1 Interpretation of Adoveo requirements 25

4.2 Experiments 26

4.2.1 Receiving beacon signals 26

4.2.2 Retrieve information from a webservice 29

4.2.3 Collecting user data 30

4.2.4 Building a library 31

4.2.5 Launching the plugin 32

4.2.6 Start the beacon service on phone boot 33

4.2.7 Beacon plugin with a notification task 34

4.2.8 Physical web and retargeting plugin 35

5 CASE STUDY: THE ADOVEO BEACON PLUGIN 37

5.1 Design 37

5.1.1 General idea 37

5.1.2 Choose which beacons to monitor 38

5.1.3 Store beacon information 39

5.1.4 Generic plugin 40

5.1.5 Division of packages 41

5.1.6 Thread pool for retargeting job 41

5.1.7 Check network before sending information 42

5.2 Implementation 42

5.2.1 Beacon representation 42

5.2.2 Beacon fetcher 44

Page 7: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

5.2.3 Beacon storage 45

5.2.4 iBeacon manager 45

5.2.5 Retargeting implementation 46

5.2.6 Data management platform client 47

5.2.7 Plugin launcher 47

6 RESULTS OF THE CASE STUDY 49

6.1 Evaluation of functional requirements 49

6.2 Evaluation of non-functional requirements 49

6.2.1 Simplicity of integration 50

6.2.2 Launching procedure 50

6.2.3 Impact on performance 50

6.2.3.1 90 minutes controlled experiment 50

6.2.3.2 12 hours real-world environment 51

6.2.4 Impact on battery life 51

6.2.4.1 One hour controlled experiment 51

6.2.4.2 Eight hours empiric test 52

7 DISCUSSION 53

7.1 Discussion of the methods used 53

7.1.1 Data collection 53

7.1.2 Implementation 54

7.1.3 Evaluation 54

7.2 Discussion of the results 55

7.3 Comparison with other solutions 55

7.3.1 Application only 55

7.3.2 Plugin with notifications 56

7.3.3 Physical web and Estimote Here & Now 56

7.3.4 Physical web with retargeting plugin 56

7.4 Research sources 57

7.5 Sustainability 57

7.6 Ethics 58

7.7 Contribution 58

7.8 Future research 58

9 REFERENCES 59

Page 8: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

LIST OF ABBREVIATIONS AND CONCEPTS

5G The fifth generation of mobile networks. Android A mobile operating system based on Linux. Android SDK API Level A specific version of the Android platform which defines what functionality is available in the system. Android Studio An integrated development environment (IDE), used for developing Android applications. API Application Programming Interface specifies how applications can communicate and use a specific software by an interface. Beacons Low-power, low-cost devices that transmits information using Bluetooth Low Energy. Bluetooth Low Energy (BLE) Technology for wireless communication that uses low energy. Also known as Bluetooth Smart. Eclipse An integrated development environment (IDE), used primary for developing applications in Java. Estimote Cloud A collection of services provided by Estimote and includes a web dashboard, beacons management, authentication and security and much more GATT Generic Attributes defines a hierarchical data structure that is used for connecting devices that uses Bluetooth Low Energy. Gradle An open source system for automating the build and associated processes for a software. GPS A navigation system that makes use of satellites in order to define the location of a device. iBeacons A protocol developed by Apple and is used in beacons. ID Identification, usually a number, is used for distinguishing different objects or subjects. Integrated Development Environment (IDE) A software application that provides tools for software development. A few examples of tools are a code editor and a code compiler that converts human readable code to machine code. Internet of Things (IoT) Everyday objects that can be connected and exchange data through Internet

Page 9: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

iOS A mobile operating system, used on mobile devices manufactured by Apple. IP-address Identifier for a node in a TCP/IP network used for identifying and locating the node. Java An object-oriented programming language developed by Sun Microsystems. Linux An open-source operating system based on Unix. MB Megabytes is one million bytes and is an entity for digital space measurement SDK Software Development Kit is a set of tools that can be used to develop applications for specific operating systems, platforms, frameworks etc. Source code A collection of instructions, data and comments that is written in a programming language TDD Test Driven Development is a software development process where tests for a functionality are written before the source code is written. Unit test A test for testing a specific component of an application Unix A collection of operating systems that Linux and Mac OSX are based on. URL Uniform Resource Locator, is a string that identifies a web resource XML eXtensible Markup Language is a mark-up language which defines rules for encoding documents XP eXtreme programming is a software development methodology that is flexible to customer requirements and is focused around good team work

Page 10: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies
Page 11: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

1

1 INTRODUCTION

Internet of Things (IoT) is everyday objects that can be connected and exchange data through Internet. IoT has been growing for several years and is predicted to be the next big thing, especially when 5G networks will be implemented and available for customers. [17, 18] Companies have started to use small devices connected to the network, to provide improved services to their customers. Beacons are one type of devices that can be assigned to the IoT category. Beacons are small, low-power, low-cost, transmitting and computing devices that transmit different information, depending on the protocol implemented. [25] The transmitted signal is meant to be received by a smartphone application or similar, which then can transform the signal to content useful for a user. Beacons do not see devices around it and do not receive any user information from any user device, they only send out information. Some beacons can also be configured remotely from other devices, using special secure communication. Beacons support different communication protocols, but the first one was Apple iBeacons. In 2013 Apple introduced iBeacons at World Wide Developer Conference. [5] iBeacons is a protocol that enables location awareness possibilities for apps. [6, 7] This means that companies can provide location based services, for example provide information about a place that is close to a user. In the beginning, beacon devices that used iBeacon technology could communicate only with Apple devices and no official support had been provided for other platforms. Later several beacon manufacturers provided software to use beacons with different protocols both for Android and Apple iOS operating systems.

1.1 Background

Common usages of beacons are information providing, advertising and indoor positioning. For example, Apple has been using iBeacons devices1 in Apple Stores, to provide information about their products. Since beacon devices are becoming more popular, more companies have shown interest in using them. One of these companies is Adoveo AB. [9] Adoveo is a company that has created a digital advertising platform using videos and quizzes. The company has currently three ways to reach a customer. The first is embedded banners in websites, the second is direct linking in text and the third is social media. Now, Adoveo is interested to add one more way to reach customers. Using beacons, Adoveo can provide location based advertising.

1 Beacons that implement iBeacons protocol

Page 12: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

2

1.2 Problem

Beacon signals are meant to be received by an application on a smartphone or similar smart devices. Since users do not download applications specifically to receive advertisement, Adoveo is interested in using a plugin in other applications to make use of beacon technology. In this thesis, different ways of consuming beacon devices with smartphones, in this case Android smartphones, will be analysed. This thesis will also discuss how companies can make use of these solutions for online advertising. The thesis research question is: RQ: Which solutions can be implemented to consume beacons with smartphone devices in order to provide online advertising?

1.3 Purpose

This thesis presents a solution that facilitates the use of beacon technology. Using the presented solution, beacon communication can be integrated in existing smartphone applications. The thesis can be used for informative purposes by people that are interested in new opportunities created by the emerge of beacon technology and those who want to learn about beacons. This includes people that are doing studies in the area, who want to use the thesis as a reference. The thesis can also be valuable to partners of Adoveo AB, that want to use the solution for their applications. The reason for this is that they will be provided with an explanation of the solution and the study behind it. The thesis can also be valuable to people that want to learn about new online marketing opportunities.

1.4 Delimitations

This thesis will consider several solutions, but will focus around the case study of developing a plugin for consuming beacons, which is a solution that Adoveo is interested in. A plugin will be developed to run on existing Android applications. The goal is that using the plugin shall require minimal work for the developers of the existing application. The case study will only focus on Android applications developed for Android SDK API level 18 or newer. Android is an open-source operating system for mobile devices. Open-source means that the source code is open for any developer. Since it is publicly available, there is almost no restriction to the development process and suits for a study, since it is easier to replicate by other people. This in an advantage over Apple’s operating system iOS, which is a closed system where development is available only on Apple computers.

Page 13: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

3

Android operating system has different versions that are defined by the Android SDK API level. The Android SDK API level is a specific version of the Android platform, which defines what functionality is available in the system. By using Android SDK API level 18 as the minimum required level for the case study, this solution will currently cover 88.9% of all the Android users. [4] The reason for not using older API levels is that Bluetooth Low Energy (BLE), used by beacons for communication, was not supported until level 18. [12] The potential of consuming different types of beacon devices is discovered in the study, but the main focus is to develop the plugin for beacon devices developed by Estimote. [10] In this case study, focus is on wireless communication with Bluetooth technology, in order to consume beacons. Therefore, other potential communication technologies, like NFC, are eliminated.

1.5 Outline

In chapter 2, the detailed background for the study is explained. The chapter also describes the pre-study that has been made, including the literature study. The literature study covers beacons, different protocols, known beacon usages, Android applications, ways to consume beacons and online advertising. Chapter 3 explains the methods used for the research and describes how methods are used to answer the research question. Methods for data collection, analysis, implementation and evaluation is described. Project methods and software development tools are also described. In chapter 4, the performed analysis, including interpretation of Adoveo requirement and practical experiments of the technologies mentioned in the literature study, is explained. Chapter 5 covers the case study made in the thesis. The design decisions made during the design phase of the case study is explained. The implementation of the product developed in the case study is also explained. Chapter 6 covers the evaluation and results of the case study. Both the evaluation for the functional and the non-functional requirements are documented. In chapter 7, a discussion is provided regarding the methods used in the study and the results from the case study. The results from the case study are also compared to other solutions. Contributions of the study and potential future research is also mentioned.

Page 14: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

4

Page 15: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

5

2 THEORETIC BACKGROUND

This chapter presents the literature study of this thesis. In order to answer the research question, information about beacons, Android, plugins, online advertisement and data management platform, is needed. Literature study includes discovering how beacon devices work, different means of communication with other devices, how Android devices can receive a signal and if the solution suggested by Adoveo is theoretically possible.

2.1 Beacons

Beacons are small computing devices that transmit data. They can run on a battery or be connected to some other power source. For example, Estimote beacons has a 32-bit ARM Cortex CPU with accelerometer, temperature sensor and a 2.4 GHz Bluetooth 4.0 Smart, also known as Bluetooth Low Energy (BLE), for communication. [25] As mentioned before, a beacon’s primary assignment is to broadcast a signal. That signal can be picked up by any device supporting Bluetooth Low Energy (BLE), covered in next subsection. Beacons cannot see devices around them or download any information from any user devices, but they can receive configuration information using special protocols. Configuration information can for example be a new setting for the signal strength. Using a secured protocol, covered in later sections, it is possible to make sure that only authorized applications can update configuration.

2.1.1 Bluetooth technology

As communication technology, Bluetooth beacons are using Bluetooth Low Energy (BLE). BLE is a low power version of Bluetooth and was built specifically for Internet of Things. [39] In comparison to standard Bluetooth, BLE sends less data and less frequently, which saves power. BLE has also a different physical layer and a simplified state machine, which allows asynchronous communication and less power consumption. [2, 43] BLE is split into 40 channels which are of two types: Advertising Channels and Data Channels. Advertising Channels are used for broadcasting data, discovering devices and initiation of a connection. Data Channels are used for communication after the devices has been connected. [43] Using Advertising Channels, advertising channel packets will be transmitted. Those packets can be data needed for discovery, connection initiation or some data that needs to be broadcasted. A device can also listen through Advertising Channels for a response to send advertising packets and also respond to them. [43] Bluetooth beacons are using BLE’s advertisement technology to broadcast data. [44]

Page 16: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

6

2.1.2 Power usage and range

Beacons require a low amount of power to operate, since they are using BLE. Some beacons can last a couple of years and broadcast up to 200 meters. Beacons manufactured by Kontakt2 has maximum range of 70 meters. [3] Estimote beacons can last more than 3 years on single CR2477 battery and can transmit information up to 200 meters. The signal range of beacons is customizable by setting different power requirements and intervals of the sending signal. Low signal power leads to a shorter range and a longer life-time. Lower transmitting interval leads to a longer life-time. High signal power leads to a longer range and a shorter life-time. High transmitting interval leads to a shorter life-time. [37] The signal can be diffracted, interfered with or absorbed by water (including human body), meaning that in real world conditions, the range may vary. [25] Bluetooth is also broadcasting on an open 2.4 GHz frequency which is widely used by many other wireless protocols, including Wi-Fi3. That means, other devices can interfere with beacons. For example, Wi-Fi has higher output power, up to 23 dBm, compared to maximum allowed 10 dBm for beacons. If a beacon is placed near a Wi-Fi source, it can, and will according to some tests, distort the beacon transmission. [42]

2.1.3 Communication protocols

All beacons implement one or several communication protocols. A protocol in this case, means a communication standard between two or several parties that specifies what kind of messages will be sent and how they are constructed. Many beacons support several protocols. Some beacons can broadcast several protocols, for example Estimote Location Beacons. Beacons that can do that are taking turns sending information with different protocols, using first one protocol and then another. Beacon that cannot broadcast several protocols, broadcast only one. The beacon configuration needs to be changed to broadcast another protocol. Several protocols exist, but this study covers iBeacons by Apple, Eddystone by Google and a few Estimote protocols, since they are supported by the beacons that will be used in the case study. [7,8] iBeacons and Eddystone also appears to be the most popular protocols.

2 Beacons manufacturer and beacon software provider 3 Wi-Fi is wireless networking technology in a local area

Page 17: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

7

2.1.4 iBeacon

iBeacon is a beacon protocol created by Apple. With this protocol beacons have been introduced to the world. An iBeacons data packet is constructed of three different ID’s [2]:

● UUID - is a unique identification number that identifies a group of beacons. For example, if one retail store chain purchased 1000 beacons, they all will have same UUID. That way, store’s receiving application can filter beacons and work only with their own ones.

● Major - an identification number that can be used to identify smaller

groups of beacons. For example, if the store chain has their physical stores in different locations, a store can be identified by a major number. For example, number 1 can be Stockholm, number 2 can be London and so on.

● Minor - an identification number that can be used to identify even

smaller groups or individual beacons. For example, in the same store, housewares can have id number 10, clothing 20 and so on.

All those ID values can be changed to suit the purpose. This protocol is broadly supported by different beacons, including Estimote beacons. [7] The iBeacon protocol is officially supported only by iOS4 devices, meaning that only iOS devices officially can understand iBeacons protocol. Even so, there are several libraries available for Android system and several beacon manufactures provide their own libraries to support iBeacons on several platforms. The Android system is covered in the Android section further on. One restriction iBeacons has compared to some others, is that an application must be created to use iBeacon signals. Eddystone protocol, described in the next subsection, has a type of message that can be received by Google Chrome application.

2.1.5 Eddystone

Eddystone is a beacon protocol developed by Google. [13] This protocol can be used by Android and iOS devices. It has several different types of payload that can be included in a message: [13, 20]:

● Eddystone-UID - a 16 bytes unique, static ID. It has two parts, a Namespace component and an Instance component. A Namespace component is a 10 bytes long character value5 and has the same purpose as UUID in iBeacons, to identify beacon groups. An Instance component

4 Mobile operating system created by Apple 5 Character value in this case can be numbers, letters or combination of both

Page 18: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

8

is a 6 bytes long character value, used for identifying smaller groups or single beacons in a group. This correspond to major and minor values in iBeacon protocol.

● Eddystone-EID - a dynamic ID that changes every few minutes, which is

used to secure transmission. [15] It is designed for security and protection from Hijacking and Spoofing. Hijacking is when an attacker uses someone else's infrastructure to deliver other content. Spoofing is when an attacker uses someone else’s infrastructure to place it in a different location. For example, a third party can copy beacon information from someone else's beacon and places it in another beacon on a bus. The Eddystone-EID id value is determined by a public key on the beacon, and can be checked by a remote resolving service using a private key. The token is relayed to the service by an application on a user device together with an authorization key. Authorization key belongs to the application and makes sure that only authorized applications can relay the token. [20]

● Eddystone-URL - a way to send a compressed URL6 that can be used

directly by a client. With this protocol, there is no need to build an application, since the URL will be opened in a browser as soon as it receives the signal. Currently, not all mobile browsers have support for that protocol, which means not all devices can open the URL directly. This is part of Physical Web. Physical Web is an open standard for IoT backed by Google and is built in into Android operation system. Google defines Physical Web as “an open approach to enable quick and seamless interactions with physical objects and locations. “[24]

● Eddystone-TLM - an endpoint for maintenance of beacons. Together

with the usual data, a beacon will send telemetry data like battery voltage, beacon temperature, beacon uptime and number of packets sent since last power-up or reboot. This signal is broadcasted less frequently than other signals.

Google recommends to set up beacons implementing Eddystone-UID or -EID to support future platforms. Eddystone also provides Eddystone Configuration Service - a GATT service. A GATT service is a Generic Attributes service. It defines a collection of hierarchical data structures exposed to connected BLE devices. Those data structures encapsulate the behaviour of a part of a device. [21, 22] “It allows the beacon to report its capabilities to apps, and for the beacon's broadcast data to be reconfigured. This service is also necessary for secure configuration and registration as an Eddystone-EID beacon.” [23]

6 URL stands for Uniform Resource Locator is a string that identifies a web resource

Page 19: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

9

2.1.6 Estimote protocols and tools

Estimote provides a range of their own protocols and tools for their beacon devices. Different protocols are suited for different purposes.

2.1.6.1 Fleet management API

Estimote have created a fleet management API for wireless configuration of Estimote beacons. When a client application receives a beacon signal, it connects to Estimote Cloud where configuration for beacons is defined. If configuration has been changed, then that client application receives the new configuration and forwards it to the beacon. That way beacon will be updated without any need of technicians going around and changing configuration manually. Fleet management API also provides several endpoints to get the list of currently registered beacons, their information and more.

2.1.6.2 Here & Now

Estimote’s Here & Now service is a way of sending real-time contextual notification based on the signal from Estimote Location Beacons. This is built on top on Eddystone-URL and Physical Web, but has a few extra benefits. As mentioned before, with Eddystone-URL beacons are sending an URL that can be picked and opened up by a browser that supports beacon signals. Here & Now works similarly. A beacon signal with Eddystone-URL is received. The link is sent to an Estimote service where it is resolved and return user defined information. That information is a title, a description and a link to a website. Then a notification is issued with the received information. [70, 71] Here & Now is built on top of Physical Web. Physical Web is build-in into the Android operating system and in Chrome widget for iOS. That means that no dedicated application is needed to be installed on user device. [70, 71]

2.1.6.3 Nearable

Nearable is a protocol developed for Estimote Stickers. Estimote Sticker is a smaller version of a beacon that can broadcast signal up to 15 meters, is waterproof and provides contextual data of physical objects, described below. The main difference between this and other protocols is that it sends actual predefined context and sensor data, not ID values. [14] Contextual data can be some kind of text message. Sensor data is temperature data, orientation in space, motion in X, Y, Z and more. [51]

2.1.6.4 Other protocols and tools

Estimote Connection, Estimote Location and Estimote Telemetry are a few important Estimote protocols and tools that handle connection to beacons, indoor localization and maintenance information about beacons. Those three are covered more in-depth in the Estimote SDK subsection further on.

Page 20: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

10

2.1.7 Common usages

Beacons are used for many different purposes. Indoor positioning is a big use case and has been researched broadly by several academic institutes, including KTH. [53] Information providing is the intended usage of beacons. Beacons send tokens that can be transformed to information about something nearby. For example, it can be a product in a store or an object in a museum. It can also be used to provide advertisement. In December 2013 Apple has deployed iBeacons in all their US stores. Users could receive product information, suggestion and offers in stores. [45] Major League Baseball added BLE beacons to their stadiums. Beacons and “At the Ballpark” application provides direction to seats, possibility to display tickets and more. [45] Store and restaurant owners can log how their customers move in a store and know which products customers stay for, and for which they do not. [45]

2.2 Android

Android is a mobile operating system for mostly smartphones, tablets and wearables. Android is developed by Google and is open source. That means anyone can see the code of the system and also can make changes and use Android as starting point for their own systems. For example, most smartphone companies that are using Android in their products, write changes to the default Android system and make it more adjusted to their own requirements. [46] Android is based on a multi-user Linux system, where every application is a user and has a unique id. Linux is an open source operating system based on Unix. [36]. An Android application runs in its own Linux process by default. [37]

2.2.1 Android Applications

An Android application is a program that runs on the Android operating system. An application can for example be a game like Angry Birds or a web browser like Google Chrome. Applications for the Android system are written in the Java programming language. The source code is compiled with associated data and resources. The compilation is done by the Android SDK Tools and the files are compiled into an Android Package, which is an archive file containing all the content of the application. The Android Package is then installed on the Android operating system. An Android application consists of different parts: application components (for example activities to show content to users and services to perform some kind of task in the background), a manifest file (which is explained more in-depth in

Page 21: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

11

section 2.2.3), and resources like images and text. An Android application can use many different system services. [37] One of these services is Bluetooth Low Energy (BLE). BLE was first introduced for Android SDK Level 18. As mentioned in the introduction, the Android SDK API level is a specific version of the Android platform which defines what functionality is available in the system. Currently about 88.9% of the Android users, uses Android SDK Level 18 or newer. BLE is therefore available on most Android devices. [12] As mentioned before, Android devices will receive different information from different beacons with different protocols. Some information will be direct content that can be shown to a user, but in many cases information from a beacon will be some kind of token. Therefore, a token has to be converted to some kind of content, which can be done in different ways. A common way is that the receiving application will receive some kind of token from the beacon device, depending on the protocol used. The application matches the beacon token with a key in a data structure, usually some kind of database. The database value associated with the key contains information, that is fetched by the application and shown to the user. Content can also be provided by extracting information from the token. For example, if the token consists of an URL when using Eddystone-URL, the application can open the URL directly in a web browser.

2.2.2 Estimote SDK for Android

Estimote SDK for Android is provided by Estimote Inc as part of their beacon products. SDK stands for Software Development Kit and provides functionality for developers to handle Estimote beacons. It also provides support for services that are included in Estimote Cloud. Estimote Cloud is a collection of services provided by Estimote and includes a web dashboard, beacons management, authentication and security and much more. [40] Those services are not covered in depth in this section. Estimote Connection, Estimote Location and Estimote Telemetry, covered in the following subsections, are all parts of the Estimote SDK for Android.

2.2.2.1 Estimote Connection

Estimote Connection is an abstraction of the connection process and hides all connection procedures from application developers. [7, 31] The SDK handles the establishment of a Bluetooth connection and provides authorization. Unauthorized parties are thereby prohibited to change beacon configuration. [31]

2.2.2.2 Estimote Location

Estimote Indoor Location SDK is set of tools to provide precise indoor positioning services. Currently, these tools are only available for Estimote Location Beacons. How precise location will be, is determined by the size and shape of the room, crowd density and number of beacons. There has to be at least, one beacon per wall. [23]

Page 22: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

12

2.2.2.3 Estimote Telemetry

Estimote Telemetry packet transmits real time sensor and health data and can be picked up by the Estimote SDK and relayed to Estimote Cloud. [33] Health data in this case, refers to the health of the beacon, for example battery life and temperature.

2.2.3 Plugins and libraries

The solution that Adoveo wants to investigate involves plugins. This section covers plugins and how they can be used in Android. A software plugin is an extension to an existing software application. The purpose of a plugin is to add functionality to an application. [19] Reasons for a software application to support plugins is to make the application thinner and to enable adding functionality from third party developers. Plugins are supported by web browsers like Google Chrome and Mozilla Firefox, and software applications like Adobe Photoshop and Eclipse. An example of a plugin used in Google Chrome is AdBlock, which blocks ads on websites displayed in the browser. [55] “Plugin” as a term does not exist in the Android world. Instead, they are referred to as libraries, that are usually imported with Gradle7. [34] Also, an Android applications can call other applications available on the device. This makes classic plugins unnecessary in most cases. [35] One of the advantages of plugins in software is that they only need to be added, and will be started automatically with the application. Consumers of the plugin do not have to do any additional programming to launch the plugin. That kind of auto start is possible on Android using an application manifest. Application manifest is an AndroidManifest.xml file that provides essential application information to the Android system, in order to run an application. Every application must have at least one such file. [27] Android also provides support for multiple manifest files that are merged to one by Gradle build. [28]

2.3 Online advertising

Online advertising is marketing and advertising displayed to consumers using the Internet. There are several different ways that advertising can be done online. One common way to advertise online is display advertising, which means banners that contain text or multimedia, like videos. Another common way to advertise is through search engine advertising, which lets advertisement be bound to keywords. The advertisement will for the most part be displayed as a search result on the top or to the right of the other search results. It is also common with social media advertising, that can be used as word-of-mouth marketing, which means people will advertise a product they like by telling other people about it. A common way to do social advertising is

7 Gradle is a build tool used to build a software project and to include different dependencies, to simplify development process. [41]

Page 23: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

13

by using social medias like Facebook. A sponsored post on Facebook looks like a regular post, but states that it is sponsored. Members of Facebook can like, comment or share the sponsored post, and the advertisement can therefore be more widely spread. There are some benefits of using online advertising compared to traditional advertisement like television and newspapers. One of the benefits of online advertisement is that it is much easier to measure than traditional advertising, like television commercials. For example, it is very difficult for a company to measure if their television commercial for a product actually affects if people want to buy the product or not. In online advertisement, the number of clicks on the commercial can easily be measured, and also what the user does after they clicked the advertisement e.g. making a purchase. The good measurability of online advertisement can also be used to choose between two different commercials. An experiment can be done when some people can see one commercial for a product and the other group can see another commercial for the same product. Then the response from the users can be measured in order to see which commercial is best. Another benefit of online advertisement is that the advertisements can be targeted to individuals, based on information about the reader. Targeting has been a desired benefit for a while, but Internet has made it a lot easier by making it easier and cheaper to find information about users. It is also easier to send different commercials online to a specific user, than to send different newspapers to different users based on targeting. There are different types of targeting. One example is contextual retargeting, that displays the advertisement based on the content of the current website. Another example is demographic targeting, which displays the advertisement based on user data, like age and gender. [26] Retargeting is another word used for targeting and is the word used in this report. One more retargeting technique is the retargeting used in geomarketing, which uses geographic information about a user or user group to target commercials. The geographic location can be provided by using for example the IP address, GPS or Beacons. [29, 30]

2.4 Data Management Platform

A Data Management Platform (DMP) is a computing system that stores and manages data. [75] A DMP stores, sorts and provides useful information for marketers and other businesses.

2.5 Earlier work

There exists earlier research on both online advertising and beacons. The research that has been done on beacons, mainly focuses on indoor positioning. Research of online advertising combined with beacons, has not been found.

Page 24: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

14

2.6 Summary

Beacons are transmitting devices with low computing power and low power requirements. Bluetooth 4.0 Smart or BLE has very low power requirements, which explains its usage in beacons. Beacon signals are meant to be received by smartphones or similar devices that can receive BLE signals and support beacon protocols. Many different protocols are used for communication between beacons and receiving devices. iBeacons is one of the first and still officially only supported by Apple products. It is closed source and transmits three different ID values that makes it possible to distinguish different beacons. An application on the receiving side converts those IDs to some kind of content that is later shown to a user. Eddystone is another beacon protocol developed by Google that is open source and has more options of broadcast messages, in comparison to iBeacons. Estimote is a beacons manufacturer whose product support both iBeacons and Eddystone and also provides their own protocols for connection, configuration, indoor positioning, telemetry and smaller types of beacons. Most research done currently on beacon devices is indoor positioning. That research is not important for this thesis since it does not answer any of the questions, but those papers provide a lot of technical information about beacons, BLE and alternatives to beacons such as NFC and Li-Fi. They are not covered in this thesis. Android is an operating system based on the open source operating system Linux. An Android application is an application that runs on the Android operating system. The application consists of application components, a manifest file and resources. Android supports BLE only from API 18 and newer, which means that currently 88.9% of users will be able to use beacons. BLE is used to consume beacons by converting a token transmitted by the beacon to content shown to the user. A plugin in Android is a library imported by Gradle. Android applications can also make use of other applications on the device, to perform some kind of task. Android supports multiple AndroidManifest-files. That is a positive sign that it is quite possible to create an auto-launching plugin for Android, and add plugin specific permissions. Online advertising is marketing and advertising displayed to consumers using the Internet. Examples of commercials used in online advertising is banners, search engine advertising, and social media advertising. Benefits of using online advertising is that it is easier to measure the success of the commercial, and to target commercial to individuals.

Page 25: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

15

2.7 Sources and related works

This section presents important sources used for this literature study.

Source Research area Key findings

Cross-platform Mobile Development and Internet of Things [2, 45]

Beacons, Bluetooth Low Energy(BLE)

Bluetooth Low Energy(BLE) was integrated into Bluetooth Core Specification 4.0 in 2010. BLE is marketed as Bluetooth Smart. BLE is transmitting less data and less frequently compared to Bluetooth Classic. Beacons current usages like in Apple Stores, at baseball stadiums and in stores.

Bluetooth Official website and technical specification [21, 22, 39, 43]

Bluetooth Low Energy(BLE)

BLE has 40 channels of two types. Advertising type is transmitting and also can receive responses. Data type is used for communication when a connection is established. GATT defines a hierarchical data structure that is exposed to connected BLE device. BLE was built specifically for Internet of Things.

Texas Instruments, Bluetooth Low Energy Beacons [42, 44]

Bluetooth Low Energy(BLE), Beacons

Beacons can be non-connectable and connectable. Since Wi-Fi is using same frequency as Bluetooth and is much more powerful, placing a BLE beacon near a Wi-Fi source can distort beacon signal.

Estimote Documentation and Estimote Community Portal [7, 10, 14, 20, 25, 31, 32, 33, 40]

Beacons, beacon protocols, Estimote SDK

General information on what beacons are and how they operate. In-depth information on iBeacon and Eddystone protocols. Information on Estimote protocols, services and security. Estimote provides a SDK that provides connection to beacons, security and several other tools.

Google Developers Beacon Documentation [8, 13, 15,

Beacons, Beacon protocols

Google beacon platform and beacon tools are available for Android and iOS devices. In-depth information on Eddystone protocol and payload types. Eddystone security protocol and how it works.

Page 26: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

16

Google Android Documentation [4, 34, 35, 37]

Android operating system

Current Android usage and version distribution. Android supports BLE only from API level 18 and higher. BLE requires user permissions. General information about key components in an Android application. Android application can request other applications on the device to perform some task. Android application does not seem to have plugins, but instead uses libraries. Android application uses App Manifest that provides information to Android system essential to launch an application.

Google Android Studio Documentation [ 27, 28]

Android Development tools

Android Studio is a tool for developing application. Android Studio project supports several App Manifest that later merged into one. Android Studio provides simple way to create Android Libraries.

Advances in Computers. 81st ed [26]

Online marketing Different types of online marketing. Benefits of online marketing compared to traditional marketing.

Page 27: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

17

3 METHOD

This chapter covers the research methods, data collection methods, implementation process, evaluation methods and tools used in this study to answer the research question.

3.1 Research methods

Research methods can be divided into qualitative and quantitative studies, described below. [54] This section also covers inductive and deductive methods, the chosen research method and the research process.

3.1.1 Qualitative and quantitative research methods

In a qualitative study, researcher interprets subject using empirical materials, for example personal experience, people's opinions and observations in natural environment. Most of the data in qualitative research is words that cannot be quantified. Quantitative study is a study formulated through numbers and statistics. It is about quantifiable data. Researchers studies the subject objectively and eliminates their personal opinions. The goal is to produce generalized and repeatable result. [16]

3.1.2 Inductive and deductive approach

By using an inductive approach, observations and patterns are used to get a better understanding of a concept or to formulate new theories. Qualitative data is often used when using this approach. The deductive approach is used to verify or falsify a theory. This is often done by performing experiments on quantitative data relevant to the theory. The experiments are done in order to test the theory. [76]

3.1.3 Chosen research method

In this thesis both qualitative and quantitative methods are used. Some parts are qualitative, such as evaluation of the simplicity of importing a plugin. Some parts are quantitative, such as evaluation of the battery usage that can be quantified. An inductive research approach is used in this study, since it is focused around exploration of new solutions.

3.1.4 Process overview

The process of the study is divided into different phases. See figure 3.1.1 for an overview of the process.

Page 28: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

18

Figure 3.1.1 - An overview of the process of the study

3.2 Data collection methods

This section covers different ways that data is collected in this study.

3.2.1 Company information

In discussion with the company, information is gathered regarding their background, their business and the background of the problem. The company provided a solution to their problem that they want analysed.

3.2.2 Literature study

During the first weeks of the project, a literature study is conducted. This includes reading earlier theses, researches, official documentations and specifications of different technologies like Bluetooth, beacon protocols and the Android operating system. Earlier theses and other scientific researches about online advertising are also part of the study intended to help answering the research question.

Problem statement

Data collection - Literature study - Adoveo requirements

Analysis

- Interpretation of

requirements - Experiments

Case study

Results and Evaluation

Discussion and Conclusions

Page 29: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

19

3.3 Analysis process

Adoveo has provided a solution they want to get analysed. Analysis is the process of performing several experiments to get a better understanding of the technology, and understand if the solutions suggested by Adoveo are possible to implement. The first step is to understand the requirements from Adoveo and what kind of solution they want to implement. This is important to identify which kind of experiments has to be done. The next step is to perform the experiments. To keep track of which experiments has to be done, a checklist is created, see table 3.3.1. The checklist includes descriptions of the experiments, the statuses (such as green for done, yellow for partly done or white for not done) and comment sections to point out important issues or other information.

Description Status Comments

Test receiving beacon signal and understand iBeacon packets

There is a problem with API 19, but it is an Estimote SDK problem. It is reported to their development team.

Test to send a UUID, major, minor to a webservice and get back the content data, such as location information

Works with our own webservice, need to test if it is possible with Estimote Cloud

Test to collect information about the user from the device

Test to build an Android library

Test to integrate the library into an Android application

Works as a local import and a local Maven dependency. Need to be tested as a remote repository.

Test different ways to launch the library 1. Auto launch works with Application object - but only one Application object can exist with manifest otherwise it does not work 2. Calling an object that starts a service

Page 30: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

20

Test to start the plugin when the phone boots up without having the user to start an application

Table 3.3.1 - Experiments checklist at one point during the work

3.4 Implementation process

After the experiments are successfully conducted, the next step is to perform a case study with an implementation satisfying Adoveo requirements. The case study is the result of the literature study and experiments and is later used to answer the research question. The implementation process starts with a design phase. Lessons learned during the experiments, and previous experience have big impact on the design. An important tool during the design process is UML diagrams. UML stand for Unified Modeling Language and is a modelling language for software engineering and design. With UML, it is possible to create structural, behavioural and interaction diagrams of an application. That helps a developer or a team to make important decisions before coding. [68] Several diagrams are used during the design stage. One important diagram is Class diagram. A Class diagram shows classes, their state, behaviour and connections to other classes. A Class diagram helps to define needed classes and their structure. Using this diagram, it is easier to decide which classes can be merged with other classes and which ones should be split into several. Classes should depend on other classes as little as possible. Reason is that if 10 classes depends on a class that will change its public parts, then the other 10 classes will have to be changed. Using Class diagram, it is easy to see if a class has too high coupling. Another important diagram that is used in the design phase is Sequence Diagram. It is an interaction diagram and shows how different components are interacting with each other. This diagram is good for defining methods and identifying design patterns. After design is complete, the application is implemented. Implementation is done in iterations. Each iteration is:

● Implement part of functionality ● Write test for the chosen functionality ● Write a function and directly test it with unit tests

Those steps are followed until the application is written and all tests are passed.

Page 31: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

21

3.5 Evaluation methods

The Oxford Dictionary describes evaluation as “The making of a judgement about the amount, number, or value of something; assessment.” [56]. Evaluation in this study is done to make sure that the functional requirements are working correctly and that the non-functional requirements are fulfilled. This shows if the implementation created in the case study is a viable solution for online advertising using beacons. This result is later used to answer the research question.

3.5.1 Non-functional requirements

Non-functional requirements are evaluated using both qualitative and quantitative methods. Important non-functional requirements to evaluate, are the simplicity of integrating the plugin to a client application and how much the performance of the client application is affected by the plugin. The simplicity of integration is a subjective quality that is different for every developer and is evaluated using qualitative method. Generally, a plugin only has to be imported and no more work has to be done by the users to start using added functionality. In this study, simplicity of integration has following qualities:

● Importing should be possible for a developer with a common software project management tool

● In the worst case, a developer has to write a simple command to call a method to start the plugin. In the best case, the plugin will launch automatically

● The original application should not change in any other way than adding code for importing the plugin and starting it

When it comes to the performance of the plugin, there are a few important qualities: the battery life and RAM usage when running it. To evaluate the performance, several tests of the product are conducted:

● The comparison of battery usage running the application in the background for 1 hour without the plugin and running application in the background for 1 hour with the plugin. In the evaluation, the beacons will be turned off and on every 10 minutes. This is a quantitative evaluation, since the data is collected and transformed into the statistics.

● The comparison of battery usage using the phone normally for 8 hours without the plugin and 8 hours of normal usage with the plugin on and with beacons in range of the phone at different times. This is a qualitative evaluation, since empirical observations are done by the user.

● An observation of RAM used by the plugin when running the plugin for 90 minutes during an active period.

● An observation of RAM used by the plugin after running the plugin for 12 hours during a normal period.

Page 32: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

22

The development tool used for the development of the plugin contains a RAM monitor which is used as a tool in the evaluation. If provides both the current amount of RAM allocated and how much memory each component in an application is using. The development tool is explained in section 3.6, further on. The battery observation is done using a battery monitor that is built in into the Android operating system.

3.5.2 Functional requirements

Functional requirements are collected in a checklist form. These requirements are measured using qualitative methods. That means that the requirements are fulfilled when testers of the application have interpreted that the requirements are fulfilled. The list of functional requirements is presented in section 4.1. Examples of these requirements are that the plugin is able to receive beacons signal by either iBeacons or Eddystone and that the plugin can collect information about a user, important for the retargeting. To make sure that application fulfils the functional requirements, log messages written by the application is analysed and a remote web service is used to check if information gathered on the phone is sent correctly to a web service for retargeting or to a Data Management Platform to handle the collected data.

3.6 Project method and software development tools

This section describes the project methods and the development environment used in the project.

3.6.1 Project method

As a method for performing the implementation part, XP (eXtreme Programming) is used. XP is an agile software development method. An agile method means that the process is flexible. An example of this is that the requirements can change during the project depending on the needs of the customer. [47] XP is used in this case study because there are many rules included in the method that are suitable for creating high quality software. There is a list of work practices that has to be followed. In practice, not all rules are followed and each developer team chooses what practises are going to be followed and which not. That way teams can adapt to different projects. A few of the practises proposed in this method are iterative work, pair programming and Test-Driven Development (TDD). These are a few of the practises followed during the implementation phase. Iterative work means that the case study is divided into smaller pieces of work and every previous piece is a building stone for the next. That way a big problem gets solved by solving multiple subproblems.

Page 33: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

23

Pair programming means that two people are programming together on the same computer. [49] At any given time, one person is writing the code and the second person is checking that the code is correct, giving advice and checking that the code has good quality. Programmers are switching roles when it is suitable, for example when one has an idea that might solve the problem. Pair programming is used to increase the quality of the code and that is the reason for using the practice in this project. TDD means that tests are written before the actual production code is written when implementing new functionality. [50] A test is written to define what is expected to be done by a certain function. Then the function code itself is written to pass the test and all other previously defined tests. When the code has passed the test, it gets refactored to be as simple as possible and all tests are run again. There are several reasons to use TDD. One is to make sure that developer is concentrating on solving the problem. When writing a test, the developer is concentrated on the conceptual view of the function. This is that the function will solve some kind of problem, where it receives some information (input) and respond with some solution (output). If the developer first writes the function and a test after, there is a risk that test will be written just to accept the function technically, but the conception goal of solving some kind of problem may be missed. More general reason to write tests is to make sure that new changes do not break the program. That means previous functions has to work as before and not get affected by new changes, unless the changes are meant to change previous functions.

3.6.2 Development environment

As mentioned in the delimitations section, all practical parts in the case study are implemented for Android smartphones. Android applications are developed using Java programming language, but with configuration and resources defined with XML. XML is a mark-up language where the tags are defined by the developer. Example of resources defined by XML in Android is text in different languages. To develop the application an IDE (Integrated Development Environment) is used. An IDE is a software application that provides tools for software development. A few examples of tools are a code editor and a code compiler that converts human readable code to machine code. Android Studio is the official IDE for Android application development and is used in the case study. [52] There are multiple reasons to use Android Studio. One is that Android Studio is an official Android IDE and is very popular, which makes it easy for others to follow this study. Since it is popular, there is a lot of documentation and support, which makes it easier to solve problems. Android Studio has tools for creating Android libraries and merge several manifest files into one. Both functionalities are important for the case study.

Page 34: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

24

Page 35: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

25

4 ANALYSIS

This section covers the practical analysis of the technologies mentioned in the literature study. The practical analysis is needed in order to be able to perform the case study. First, an interpretation of the Adoveo requirements is explained. Then the experiments that are conducted are explained, with explanations on how they are conducted, and the outcome of the experiments.

4.1 Interpretation of Adoveo requirements

Adoveo’s general requirements are to create a plugin that is inserted into

partners applications to receive beacons and perform a task when beacon

signal is received. There are several different tasks that are considered to

make use of the beacons in advertising.

Adoveo’s original idea was to show advertisement as notifications. This turned

out to be possible to do only in a few cases due to legal issues. This is further

explained in the result and discussion.

The modified version of the product is to create a plugin only for retargeting.

Table 4.1.1 is showing a checklist of the functions that plugin have to perform.

Description Status

Be able to receive signals from a beacon using iBeacon protocol

Be able to convert the beacon signal to information needed for retargeting, e.g. beacon position and which store it belongs to

Be able to collect needed information about a user (e.g. user identifier and current time) and store a cookie

Be able to send both the beacon information and the user information to a webservice

Be able to integrate the plugin into any Android application with API 18 or greater

To not interrupt work of the original application, e.g. an error in the plugin will not affect the original application

Table 4.1.1 - Checklist of the functional requirements for the case study

Page 36: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

26

4.2 Experiments

Before performing the case study, eight practical experiments are conducted to get a better understanding of the technology. The experiments also impact on the design of the implementation created in the case study.

● The first experiment is conducted to learn how to work with beacons and receive beacon signals using an Android application with a background service.

● The second experiment is to learn how to translate the received beacon

information to user friendly content, by using a web service.

● The third experiment is to learn which information can be collected by an Android application.

● The fourth experiment is to learn how to create a plugin for Android as

a library.

● The fifth experiment is to learn how to integrate and launch the Android plugin

● The sixth experiment is to learn how to start the plugin on reboot of the

phone, without the need for a user to start the application.

● The seventh experiment is about combining the first, fourth, fifth and sixth experiments into a single plugin. New functionality is also added to learn to perform a task alongside listening for beacon signals. Several overall tests are also performed to check plugin functionality in different real-world situations.

● The eighth experiment is about trying to remove the need of having to

build a beacon manager that listens for beacons and use the existing functionality provided by the Physical Web.

4.2.1 Receiving beacon signals

The first experiment is about learning how to receive beacon signals using Estimote SDK and to check if there are any problems with different devices. This is an important part of answering the research question since this research is about beacons and how they can be used with smartphones. First, a new project is created in Android Studio. There are different decisions that has to be made when creating an Android Product, such as API level, if application will be for phones or for TV or other devices. In this case, it is a phone application with minimum API level 18 since that is the lowest API level that supports BLE. The next step is to import Estimote SDK into the project which is done by adding a dependency into the Gradle build file.

Page 37: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

27

The next step is to follow the documentation provided by Estimote on how to receive beacon signals. First part is to initialize the Estimote SDK with an application ID and an application token. The application ID is a unique identifier of the application and the application token is a security token that is needed to authorize the application on Estimote Cloud. Estimote Cloud is a service provided by Estimote to manage beacon settings, to manage application, to collect analytic data such as number of users passing by a beacon and also to enable secure UUID. Both the application ID and the application token is generated in Estimote Cloud. The next step is to create a beacon manager that defines listeners and starts monitoring beacons. A listener in this case is a set of methods that will react to a certain event, such as a beacon signal. For example, when the application gets into the range of a beacon, one of those methods is executed. Estimote SDK provides different types of listeners for different protocols. The different types are monitoring, ranging and scanning. Monitoring is creating a geofence, a virtual area, which an application can sense by entering or leaving the area. Ranging is actively scanning for beacons and getting their proximity data. Both these types are created for iBeacon protocol. Scanning is the same as ranging, but that word is for the protocols Eddystone, Estimote Telemetry, Estimote location and Nearables. Important differences between monitoring and ranging/scanning is that monitoring can run in the background when application is inactive and that ranging/scanning need more power and are not recommended to run for long periods of time. [57] The implementation created in the case study is planned to be able to run in the background which means that in this experiment, monitoring of iBeacon protocol is used. Since the beacon manager have to run in the background constantly, it has to run in its own thread. One way to do that is to place the beacon manager in a Service and start a new thread inside it. An Android Service is a component that can perform long-running operations in the background. It does not provide a user interface (UI), but can communicate with an activity that provides a UI. This service will be unbound, which means that it will not be bound to any application components. That means that even when an application is closed completely, the service will still be able to run in the background. The only way a user can shut down a service is to get into the settings of the Android system and kill the service. The Android system can also kill the process in case there is too low memory left for the device. There is a way to make sure that service gets restarted in case Android system kills the service. Service has a method onStartCommand(), which is called when service is started. This method returns a flag value, that tells the system what will happen when service gets killed. START_STICKY flag defined in the Service class, makes sure that the service gets restarted in case it gets killed. In this experiment, a Service is created to manage iBeacons signals. Figure 4.2.1.1 shows the conceptual idea of running a service in the background independently.

Page 38: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

28

Figure 4.2.1.1 - The idea of running the service in the background independently of the application The next step is to define the listeners. This is done using the beacon manager that comes with Estimote SDK, by overriding two methods for when an application is entering and exiting a region. The application will check if it has entered or exited a region in defined intervals. The default interval is 25 seconds and the scanning time is 5 seconds. That means an application will check if it is in a region for 5 seconds and then sleep for 25 seconds before checking again. That also means that in the worst case it can take 30 seconds for an application to react on exiting a region. These values can be changed, but it is important to consider battery life when changing the values. In this experiment, the values are left as default. When an application enters a region, it logs a message with information about the region. When exiting the region, a log entry will be written with the region information. The last step in the experiment is to start monitoring beacons. That is done by calling the beacon manager with the startMonitoring(region) method. An input parameter to the function is a region which can be defined in different ways. As mentioned in the literature study, an iBeacon message has three parts: a UUID, a major value and a minor value. A region can be defined with UUID, which means that all beacons with same UUID will create a region. A region can also be defined with UUID and a major value. That means that all beacons with same UUID and major value define the same region. Lastly a region can be defined with all three values and that means that all beacons with the same values defines a region. Usually, the last case means that every beacon is defining different region since minor values usually identify individual beacons. In this experiment, all three configurations are tested (see code snippet 4.2.1.1).

Page 39: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

29

UUID uuid = UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D");

BeaconRegion beaconRegion = new BeaconRegion("bid", uuid, 64481,

36443);

beaconManager.startMonitoring(beaconRegion);

Code snippet 4.2.1.1 - Example of start monitoring a region When an application is created, it is tested on different devices with different API levels. The outcome of this experiment was an understanding of how to create an Android application, how to add an Estimote SDK, different ways to detect beacons, how to define which beacons should be found. By testing on different devices, it also turned out that when using API 19 on a Samsung Galaxy Trend 2 Lite, the application is crashing due to a bug in Estimote SDK. That bug has been reported to Estimote development team and the bug is said to be known and fixed in the next release of the EstimoteSDK.

4.2.2 Retrieve information from a webservice

The previous subsection describes the experiment conducted to receive signals from beacons. These signals need to be converted into something useful to fulfil the purpose of the plugin, namely to create retargeted marketing based on precise location. This experiment is done in order to gain a better understanding on how a beacon signal can be converted to useful information. The experiment is done by creating a remote web service that uses a REST API8 on a Raspberry Pi and an Android application that retrieves information from the web service (see figure 4.2.2.1). The web service uses the token, that is transmitted by beacon signals, as hardcoded keys in a HashMap9, with an associated value. The Android application consists of three buttons that, when pressed, sends different HTTP GET requests to the REST API of the web service. One of the tokens that exists in the HashMap is also included in the GET request. HTTP is a protocol that is used for communication between client and services. The HTTP GET request is used by HTTP to retrieve information from a resource. [67] The web service returns the value that is associated with the token sent to the Android application and the value is displayed to the user in the Android activity. The Android activity is an application component of an Android application that is used for user interaction. The value that is used in this experiment is information about the store that the beacon is associated with. The response time of the request made is also measured.

8 An API that is built with REST architecture, where every information is a resource and usually can be accessed with simple HTTP GET, POST and other HTTP messages. Since it is a big topic, it is not explained fully in this thesis. 9 Java class that is based on a hash table and is used to map keys to values [66]

Page 40: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

30

Figure 4.2.2.1 - Communication between Android application and REST API The experiment provides an indication that it is possible to retrieve information from a web service by sending HTTP GET requests from an Android application. It also provides information on how it can be done practically. The experiment also shows that the communication between the Android application and the web service is fast, since the web service response was fetched on between 30 and 270 milliseconds. This result was collected when the web service was not on the same LAN.

4.2.3 Collecting user data

To be able to answer the research question, the possibilities of using mobile technology to provide a user with retargeted online advertising needs to be discovered. The beacon technology is used to get precise geographic information about the user but there is also other information that can be useful for the plugin, in order to improve the retargeting. An identifier, like an email address, is needed for doing beacon retargeting. Other information than can be useful for beacon retargeting is the time a user passed a beacon and information about the device a user uses. It is important that the extra information gathering, does not make a big impact on the performance of the plugin. This is important because a bad performance of the plugin can make the overall performance of the application with the plugin worse. The experiment is performed by testing different solutions for collection of user data in an Android application. There are different ways to collect information that can be used to identify a user. One way that can be used, is to integrate a sign in function using a social media like Facebook or Google. [58, 59] When using this type of method to collect information, the user of the client application has to sign in to the social media in some way. On Facebook, the user also needs to agree to permissions in order for the application to access user information. [60] The problem with this is that the user then needs to sign in to the social media and also potentially grant the application permissions when using the client application. This is not a necessity in many of the client applications today and therefore this will make the application less user friendly.

Page 41: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

31

Another way to collect an identifier of the user is to use information from the Google account stored in the system. This can be done in Android by using two classes called AccountManager and Account, displayed in code snippet 4.2.3.1. [61] One benefit of this method is that a user of an Android phone needs to have a Google account to download applications on Google Play Store10. This means that if a user uses an application with the plugin, they need a Google account. That way, the user information can with guarantee be collected from the phone. One difference from the other method, mentioned above, is that the only information that can be collected is the email address of the user. Since only an identifier is needed, this is not really a problem for this case study. One disadvantage is that a dangerous permission needs to be declared. A dangerous permission means a permission that can affect the privacy of a user or change data that is stored on the device. When using a dangerous permission, the user has to declare that the permission is granted explicitly. [62] If the client application does not already use the permission, a new dialog needs to be added to the client application that asks to get information about the user’s contacts. This can both be disturbing and there is a risk that user’s do not want to share that information. AccountManager accountManager = (AccountManager) getSystemService(ACCOUNT_SERVICE); Account[] accounts = accountManager.getAccountsByType("com.google"); Code snippet 4.2.3.1 - shows how to get email information in Android To get the current date and time, there are built in methods in Java using the class Calendar. The class can be used to display both the date, time, time zone and more. [64] Information about the device the user is using, can be collected by using static fields from the Android class Build. [65] Examples of information that can be collected is the manufacturer of the device and the device model.

4.2.4 Building a library

This experiment is a test of one of the key aspects of the case study, namely creating a plugin. Plugins are created as libraries in Android. This experiment is conducted to learn how to create Android libraries. A library in Android development environment is an application module. A normal application module is compiled into an APK (Android Package Kit) file which the Android system can run as an application. A library module is compiled into an AAR (Android Archive) file, which as minimum contains resources, source code written in Java, tests for the source code and the Android manifest. Since the library is a regular Android module, it has the same structure as a usual Android application. In every Android module, there is a Gradle build file that defines the configuration for the module. An Android module can be defined as an Android Library by specifying that in the Gradle build file. [63]

10 Googles application store where user can buy and download applications, music, movies and other content

Page 42: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

32

That will make sure that when a library module is built, it will be built as a library and compiled into an AAR file. That also means any application can be converted to a library, only by changing the first line, from the code displayed in code snippet 4.2.4.1 to the code displayed in code snippet 4.2.4.2. apply plugin: 'com.android.application' Code snippet 4.2.4.1 - part of Gradle build file for an application apply plugin: 'com.android.library' Code snippet 4.2.4.2 - part of Gradle build file for a library To perform this experiment, a new module has been added to the project created in the first experiment. An Android Studio tool is used to create the module. [34] That tool creates a library module with a defined name and Android properties, including a minimum SDK value. The functionality of the test library is to log a message. A function is defined in a class in the library which will be called from an Activity in the application. To make use of the library, it has to be imported into the application project. This is done by adding a dependency for the library in the Gradle build file.

4.2.5 Launching the plugin

In the previous experiment, the functionality of the library was launched by calling a function. Conceptually, it might be possible to use auto launching to start the plugin. This experiment shows if it is possible and if it works for commercial applications. In this experiment, the library class is changed to extend the Application class. Application class is the base class for maintaining a global application state. This class is run before any other developer defined class. This class has a few methods that can be overridden. The onCreate() method is called when an application is created. This method is overridden in this experiment to call a method that will print a log message. The Application class also has to be defined in the Android Manifest file for the library. A log message is also printed from an Activity class when it gets created to make sure that it will run after the Application class. An Activity in this case is an empty Android Activity that has no user interface. The line of code that calls the library to write a log message is removed. The application is now rebuilt and rerun. The messages from the library is displayed automatically and before the message from the Activity is displayed. Next step in the experiment is to try to integrate the library in a real application. Wikipeia’s Android application is open source and exists on GitHub. It makes a perfect candidate for testing since it is a big application, has many different classes and made to work for many users with different devices. The application is cloned from GitHub using Android Studio. The test library is imported as in the previous experiment. The build sequence is started. During the build, an error occurs and build stops. It turns out that Wikipedia’s application also has an Application object and there can be only one Application object in the Android application. This result was expected since the Android documentation mentioned that only Application object can be defined in the Android Manifest.

Page 43: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

33

This experiment showed that there is a way to auto launch a library, but it will work only if the client application does not have an Application class already. Another problem that the experiment revealed is that if an application has lower minimum SDK than the library, the application will not be built. The error occurs during merging of the application Android Manifest and the library's Android Manifest. This is happening since it is forbidden by the Android system for an application to have lower minimum SDK than a library. Minimum SDK value indicates minimum Android API level on which an application will run. There is a way to solve the problem by defining an override rule in application Android Manifest. This line is telling the Gradle to use minimum SDK value of an application. [69]

4.2.6 Start the beacon service on phone boot

This experiment is conducted to find out, if there is a way to launch the background service without having the user to launch the application after the phone is restarted. Estimote provides a documentation about launching an application on boot of the phone. It is done by implementing a BroadcastReciever in an application. When Android system start, it sends a broadcasting signal to applications on the phone, telling that the boot procedure has been done and the phone is ready to be used. An application with a BroadcastReciever can receive that signal and perform some kind of task. In case of a plugin, it works the same way. Figure 4.2.6.1 show the interactions between the different components in the plugin. The problem lies in that a user has to allow a few permissions to the application in order to use beacons. That is done by showing a dialog to a user. To launch a dialog, an Android Activity is required. That means that some part of the code has to be in the main Activity and part has to be called from BroadcastReciever. This violates the idea of having an easily launched plugin.

Figure 4.2.6.1 - A simplified diagram of the interaction between components This experiment showed that there is a way to start a service on boot of the application, but it comes with a cost of writing more code in different locations.

Page 44: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

34

4.2.7 Beacon plugin with a notification task

This experiment is a combination of the first experiment, concerning receiving beacon signals, and experiments with a plugin and the launching procedure. This test also adds the functionality of showing a notification when entering or exiting a region, instead of writing a log message as was done in previous experiments. That way it is possible to test the application without having the device connected to a computer. First, a new library module is created and the classes from the first experiment with the beacons are copied into the new library. The Estimote SDK dependency is added to the Gradle build file of the library. The next step is to remove the logging functionality and add notification functionality. The notification functionality is placed outside the beacon manager to simulate a real-world task. The reason is that a real-world task might be long running task, which means that it should not run in the same Service as beacons listener to not miss a region. Since the Service will run continuously, there is no way for it to return a value when it is done, like with a normal function. Instead a ResultReceiver object is used. ResultReceiver is a built-in class, that is used to receive a message bundle from another component in the system. An object that wants to receive a message, is extending ResultReceiver and overriding a method called onReceiveResult(...). In this method, a behaviour is defined for a received result. When the Service is started, it gets a reference to the ResultReciever and saves it in a field. When the plugin receives the signal from a beacon, beacon listener calls a onReceiveResult(...) method of the saved reference and passes the result through a message bundle. In this case, the message bundle contains the UUID, major value and minor value when entering a region and a message with the UUID when leaving the region. This is an example of the Observer pattern in object-oriented programming. The next step is to test if the plugin can detect beacon regions properly (both entering and exiting) using the old application. The test is conducted as before: importing the library, call the library launch procedure from the Main Activity and try to receive beacon signals. Several tests are conducted:

● Entering and exiting a region with the application open ● Entering and exiting a region with the application in the background ● Entering and exiting a region with the application killed ● Entering and exiting a region with the phone restarted and without

starting the application by the user After the tests are passed, the plugin is imported into the Wikipedia application and the same test are conducted. This experiment showed how to add notifications to an application, how to work with the ResultReceiver class that might be needed for the case study and that it is possible to use beacons with a plugin. A small RAM check has also been

Page 45: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

35

conducted to see how much RAM the plugin uses and how much it fluctuates. Values has been recorded under one hour and values were between 15-17 megabytes (MB) when the application closed by itself. The RAM measuring tools used here are not as accurate as the one used in the evaluation of the case study further on and the results in RAM usage can vary.

4.2.8 Physical web and retargeting plugin

This experiment is about performing the experiment with Physical web to eliminate the need of creating the beacon signal receiver and only concentrate on creating a retargeting plugin. As found in the literature study, Google has integrated a way of receiving the beacons into the Chrome browser for Android or the Chrome widget for iOS. Since the Chrome browser is pre-installed on Android, there is a built-in way of receiving the signal. If it can be used to receive beacons signals, then there is no need to create beacon manager in a retargeting plugin. The Physical Web will issue a notification as soon as a beacon is found. The notification contains a title, a description and possibly an URL that the user is redirected to when pressing the notification. If the notification event can be received and used by the plugin, then it would have all the information needed to perform retargeting. Android system provides a way of intercepting the notifications and also allows to read them, but only if the user allows it. The user has to change the security settings to allow applications to read notifications. Result of this test is that the solution is technically possible and solves the problem of needing to create a custom beacon monitor, but it requires users to allow applications to read notifications.

Page 46: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

36

Page 47: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

37

5 CASE STUDY: THE ADOVEO BEACON PLUGIN

This section describes the solution implemented for the case study. The case study is done in order to find results that later is used to answer the research question. The solution described is a plugin for Android applications used for performing retargeting using beacons. Firstly, the design decisions made for the solution are described. Thereafter, the implementation steps are explained.

5.1 Design

Creation of the design is based on earlier experiments. This section will mention the general structure and a few important design decisions.

5.1.1 General idea

In the case study, a plugin is created which will be integrated in different applications on the Android system. An end user has an application installed on their phones with the plugin integrated into it. When the user passes a beacon, the plugin reacts to it. The plugin collects information about where this beacon is located and which store it belongs to. After that, it collects information about the user and creates a cookie on their phone. A cookie in the case study is a randomly generated value, not an email as done in the experiment 4.2.3. That way any collected data is anonymous. The information about the beacon and the user are sent to a remote Data Management Platform (DMP). The information in the DMP is later used to create a retargeted advertisement for the users and be shown in an application. Note that the plugin is not created to show advertisement. Figure 5.1.1.1 shows a conceptual diagram of interactions of the nodes in the case study. An example of a use case is if a user passes by a Starbucks, that has beacons, in the morning. The plugin will receive a beacon signal and send information to the DMP, that a certain user has passed by the Starbucks at 08.00. Later on when the application with the plugin is used, the user will see an advertisement about a deal at that specific Starbucks.

Page 48: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

38

Figure 5.1.1.1 - Conceptual diagram of the interactions in the case study

5.1.2 Choose which beacons to monitor

When doing monitoring, the plugin need to be able to react on signals transmitted from the beacons used by the partners of Adoveo. Therefore, the beacons listened to, needs to be specified to the monitoring service. This can be done in multiple ways. One approach is that the application that uses the plugin, can store a list of beacons that is sent to the plugin when starting it. The beacons in the list are then used when doing the monitoring. One problem with this solution is that it requires extra work for the developers of the client application, which means it does not fulfil the requirements for the plugin. Another approach is that the monitoring listens for all beacons that exist, by not specifying any UUID, major or minor. That way, all beacons, both Adoveo’s and others, are being monitored. There are two problems with this approach. One problem is that the plugin is going to consume more energy, since it is going to react to all beacons. Another problem is that a region will be defined for all beacons. Since the plugin only reacts on entering (where one beacon is noticed) and exiting a region (where no beacons are noticed anymore), it will not react on a new beacon in the same region. An example of a scenario where this can be a problem is if a store has multiple beacons in the same region. If a beacon is reacted upon in the region, that is the only beacon that is going to be reacted to and the customer may miss out an important offer. This is the reason that UUID, major and minor, needs to be specified in order to be able to react upon every beacon signal.

Page 49: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

39

The last approach and the approach that is used in the implementation, is to fetch a list of all beacons from the Estimote Cloud. All the beacons associated with partners of Adoveo are registered on the Estimote cloud account and all needed beacons are therefore fetched and used as regions for the monitoring. That way, minimal work is needed by developers of the client application and the regions can be divided by both UUID, major and minor.

5.1.3 Store beacon information

As mentioned in the previous subsection, the plugin requests the list of beacons to be monitored from Estimote Cloud. Later on, when doing retargeting, the plugin requests detailed information about a nearby beacon, information like geolocation and which store or place the beacon is owned by. This means another request is done to Estimote Cloud. There are two ways this information can be gathered. One way is that the beacons that earlier were fetched from Estimote Cloud, are stored in a data structure in the application. The information is then fetched from the data structure. The other way is that a new call is made to Estimote Cloud, for each specific beacon. In the first case, potentially a lot of information has to be stored on the user device. That is the case if there are lot of beacons used by the advertising company. In the second case, space on the device will be saved, since initial information will not be stored, but there will be a lot of traffic generated to get detailed beacon information. To make a decision, a couple of observations and calculations are done. These are explained below. Since there are no filters at Estimote Cloud API, the plugin has to request all information about all beacons and then filter it on the client side. The best solution would be to have another service perform that kind of logic, but in this case, it is a decently lightweight operation, and can be done on the client side. The size of the information about one beacon is ca 3.3 kb (kilobytes) and for 100 beacons it is ca 330 kb. In the first case mentioned earlier, 330 kb of initial information will be requested plus 3.3 kb for each beacon nearby. In the second case, 330 kb of initial information will be requested and some of it will be stored, but no more network requests will be made. For each beacon information packet that is received, there is a lot of unnecessary information that will not be stored. All received beacon information that should be stored, is stored in a Java object. Those objects are stored in an HashMap, since there is a need to get information about a specific beacon. To find out how much memory storing information will take, a test project is created. It that test, the program queries Estimote Cloud for three beacons and then stores needed information in objects in a HashMap. Table 5.1.2.1 below shows the size of each object and how much space a HashMap will take with three objects.

Page 50: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

40

Object weight (bytes) HashMap after adding the object (bytes)

Added object 1 520 680

Added object 2 504 1216

Added object 3 520 1768

Table 5.1.2.1 - Table represents results of the memory test by saving objects into a HashMap The result shows that the size of a HashMap storing three of the beacon Java objects is 1768 bytes = ca 1.8 kb. For 100 beacons, it will be approximately 59 kb, and for 1000 beacons approximately 590 kb. As showed, the HashMap does not take up much space. There is also no network latency when using that approach. The last problem is the consistency of the initial information download. Since the beacon service is meant to run in background all the time, the initial download would be done only once, when the service is started. This is not entirely true in practice. As mentioned in the literature study, the Android system will shut down the service as soon as the system needs memory for something with higher priority. The system will restart the service as soon as enough memory is available. This results in that the beacon Hash Map will be updated. As a result of this test, the storing method is chosen over constant network requests.

5.1.4 Generic plugin

This plugin is being created as generic as possible. It means that the plugin is easy to change and adapt to new technologies. For example, as can be seen in figure 5.1.4.1, BeaconStore object contains a list of beacon information fetchers of type CloudBeaconFetcher. The CloudBeaconFetcher interface is implemented by any object that will fetch beacons from the cloud. That means that, if in the future, the company decides to use other products than Estimote, the developers will just create a new beacon fetcher and add it to the list of fetchers. No other work in changing previous written code will have to be done.

Page 51: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

41

Figure 5.1.4.1 - BeaconStore contains list of CloudIBeaconFetcher instances which can be several different implementations of the interface The plugin is built with that kind of thinking in mind, to make sure that future changes and future technology can easily be implemented.

5.1.5 Division of packages

Different classes of the implementation are divided into different packages to maintain high cohesion between clusters of classes. The classes have been divided into four different packages called util, beacon, apiclient and retargeting. These packages are inside another package that is used to differentiate the plugin from other software. The beacon package consists of classes that has something to do with beacons. The apiclient package consists of classes that are used to communicate with APIs and classes related to those classes. The retargeting package consist of classes used to perform the retargeting.

5.1.6 Thread pool for retargeting job

When a beacon is found in proximity, retargeting process will be started. It is essential for the plugin to continue listen for other beacons while retargeting is done. That means that retargeting has to be performed in a separate thread. Since plugin will be run on different mobile devices, the computing resources have different limitations, and it is hard to give an optimal number of maximum threads for all devices. To solve the problem, a thread pool with a blocking queue is implemented. The maximum number is determined by the number of cores on the phone. Every job is put into a queue and free thread will get jobs from the queue. In case there are more beacons in proximity than place in the queue, the blocking queue wait until there is a free space.

Page 52: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

42

5.1.7 Check network before sending information

The plugin will be used on a mobile device, which means that there are no guaranties that there would be a connection to Internet. There also are no guaranties that the connection would be a good connection. To not cause any exceptions in the application, a network util is created to check if a connection is available. If not, it waits for a few seconds and check the connection again.

5.2 Implementation

This section describes the implementation of the plugin in the case study. Implementation is starting from the classes that can exist independently of other classes. That means that the property loader, the retargeting part and the beacon representation are the first parts to be implemented. The reason it is done that way is because the beacon representation is needed for the beacon fetcher, which is needed for beacon store which is used by beacon manager. The beacon representation itself is not dependent on any other functionality.

5.2.1 Beacon representation

Figure 5.2.1.1 - Class diagram for beacon protocol implementation The beacon representation starts with the implementation of the beacon protocol representations. As mentioned in chapter 3, each implementation is started by writing unit tests and for each method implemented, the tests are run. The first step is to create the beacon protocol representation, see figure 5.2.1.1. Since there are rules for what kind of UUID, major and minor values that are possible, the values are validated on creation of the object.

Page 53: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

43

Figure 5.2.1.2 - Class diagram for beacon and Estimote iBeacon representations Next step is to create a representation for the beacon and also a representation of the Estimote beacon, see figure 5.2.1.2. EstimoteIBeacon class is extending Beacon class since it is a beacon, but contains tags that are unique to Estimote beacons. The reason that the Beacon class exists is to provide easy integration of other beacons in the future. That is because all beacons have a unique identification value, location and list of protocols that they are broadcasting.

Figure 5.2.1.3 - Class diagram for EstimoteIBeaconDeserializer Next step is creating a deserializer that can transform beacon information received from a service as JSON to a Java object. This is done by using Fasterxml Jackson library that provides functionality for creating custom deserializers. [71] In this case, the deserializer finds JSON nodes in the JSON tree, get the values and create the Estimote beacon object with those values. See figure 5.2.1.3 for the class diagram of the deserializer.

Page 54: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

44

5.2.2 Beacon fetcher

Figure 5.2.2.1 - Class diagram for the Estimote Cloud beacon fetcher When the beacon representation is created, it is possible to create EstimoteCloudBeaconFetcher (see figure 5.2.2.1), which fetches the list of registered beacons from Estimote Cloud. To implement this class, a couple of other classes must be created. Firstly, a property provider needs to be created. The property provider is needed to get an access token in order to access Estimote Cloud for fetching beacons. Secondly, a network client, that shares a behaviour that all classes using the network need, is created. The shared behaviour is waiting until there is a connection to the Internet, before trying to send anything. The third and last component to create is the CloudBeaconIFetcher interface. This interface is meant to be implemented by any class that will fetch iBeacons from any cloud including EstimoteCloudBeaconFetcher .

Page 55: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

45

5.2.3 Beacon storage

Figure 5.2.3.1 - Class diagram for BeaconStore The beacon storage class is used to store the beacons fetched from other services. The data structure for the storage is a hash map. A hash map is a storage of key-value pair where key is used to identify the value. See figure 5.2.3.1 for the class diagram of the BeaconStore class.

5.2.4 iBeacon manager

Figure 5.2.4.1 - Class diagram for the IBeaconManager class

Page 56: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

46

The iBeacon manager is implemented to request the beacon storage for beacons to listen to, then listen to the beacons and perform retargeting when a beacon is found. IBeaconManager (see figure 5.2.4.1), is implemented as an Android service to enable it to run in the background, even if the application that started the plugin is closed. Since Android service is running on the main thread by default, it cannot be used to perform any network calls. That is why all operations in beacon manager is run in another thread. To implement the listening part, Estimote SDK is used. It is chosen since the beacons in current use are manufactured by Estimote and it is also simple to use. Theoretically, the implementation finds any beacons, not just Estimote’s, as long as a non-secure UUID is used. If a secure UUID is used, the UUID will be checked against the registered beacons on Estimote Cloud and if it does not exist there, it will be ignored.

5.2.5 Retargeting implementation

Figure 5.2.5.1 - Class diagram for retargeting thread manager As mentioned in design section, to solve the thread problem when starting retargeting, a thread pool is implemented. To keep thread management out of the IBeaconManager class, a thread manager is created, see figure 5.2.5.1. It is called by the beacon manager with beacon information gathered during the listening.

Figure 5.2.5.2 - Class diagram for retargeting functionality

Page 57: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

47

There is a new thread started every time a user enters a beacon region. In the thread, a new Retargeting object is created. Information about the beacon in the region is passed to a method in Retargeting class called “retarget”. That method also fetches a user identifier and the current time when the user entered the beacon region. The user identifier is not fetched using the approaches discussed in section 4.2.3. Instead it is fetched from the SharedPreferences of the Android operating system, where it is stored the first time a user uses the plugin. The shared preferences are used by Android to persist information, that can be used by multiple applications. The user identifier is handled by a class called UserIdFactory. When the Retargeting class has collected all needed information, it sends it to the client for the DMP (Data Management Platform). In figure 5.2.5.2, the classes that handles the retargeting process are displayed.

5.2.6 Data management platform client

Figure 5.2.6.1 - Class diagram for data management platform client The next step is to create functionality for sending the collected information to a DMP, see figure 5.2.6.1. DMP Client is a network client that performs just that. A framework is used to implement communication with DMP service. A framework, in software development, is a set of conceptual structures and guidelines with a set of libraries and tools to build software products. [74]

5.2.7 Plugin launcher

Figure 5.2.7.1 - Class diagram for plugin launching class

Page 58: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

48

The last class to be implemented is the launch class, see figure 5.2.7.1. The experiment 4.2.5 showed that auto launching is not an option for a plugin that is inserted into different applications. The launch on reboot that was showed in experiment 4.2.6 is not implemented. In the experiment, an Application object was used to perform the auto launching. It is problematic if the application, that integrates the plugin, already has an Application object. For further explanation of the problem see 4.2.5. The functionality is not very important to the case study and is therefore not implemented. The solution in this case study is to use a launch command that will be called by the developers of the original application. The AdoveoBeaconPlugin class checks if a user has given the permissions needed to run the plugin and starts the beacon manager. Before starting the manager, it checks if the service is already started. It is important since multiple application can contain the plugin which would lead to multiple services running and a lot of duplicate information would be send to the DMP and provide inaccurate retargeting. It would also use more space and battery. For example, if a beacon manager for iBeacons is running and a beacon manager for Eddystone is to be launched, the method should check if the Eddystone manager is already running, not all of the managers. The Eddystone manager does not exist currently, but could be added in the future.

Page 59: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

49

6 RESULTS OF THE CASE STUDY

This section describes the results found by the evaluations of the plugin, created in the case study. The result shows if the plugin created in the case study is a viable solution for online advertising using beacons. This result is later used to answer the research question. The evaluations are done both for the functional requirements and the non-functional requirements of the plugin.

6.1 Evaluation of functional requirements

As mentioned in the method section, evaluation of functional requirements is qualitative and based on fulfilment of the business requirements. To evaluate the functional requirements, the plugin has been placed into a realistic environment for an extensive period of time. The evaluation is done by observing log messages written by the plugin during the execution and also by checking on the service side that the information has been received and the format is understood. Table 6.1.1 shows that all the functional requirements are fulfilled.

Description Status

Be able to receive signals from a beacon using iBeacon protocol Pass

Be able to convert the beacon signal to information needed for retargeting, e.g. beacon position and which store it belongs to

Pass

Be able to collect needed information about a user (e.g. user identifier and current time) and store a cookie

Pass

Be able to send both the beacon and the user information to a webservice Pass

Be able to integrate the plugin into any Android application with API 18 or greater

Pass

To not interrupt work of the original application, e.g. an error in the plugin will not affect the original application

Pass

Table 6.1.1 - The checklist of the functional requirements

6.2 Evaluation of non-functional requirements

This section presents the results of the non-functional evaluation. This includes evaluations of simplicity of integration, launching the plugin, phone’s performance and battery life.

Page 60: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

50

6.2.1 Simplicity of integration

The plugin integration is done using Gradle dependency management. Dependency management tools, such as Gradle and Maven11, are the most common ways to add external libraries to an existing project. If a company, like Adoveo, wants to have the library published openly, it only requires one row of code to add the dependency to an existing project. If the library is to be private, then the credentials have to be entered, which adds two more lines of code and also a line of code to point to the repository where the dependency can be found.

6.2.2 Launching procedure

The launching procedure is done with only one line of code. new AdoveoBeaconPlugin(this)

.launchEstimoteBeaconsRetargeting(BeaconProtocol.Type.IBEACONS);

Code snippet 6.2.2.1 - Example of the launching code Developers of the original application will have to create a new object and call a method to launch the plugin. As can be seen in the code snippet 6.2.2.1, it is a long command because of the descriptive names, but the command is programmatically simple and does not require any error handling. Important limitation of the launching procedure is the placement of the launching command. It has to be placed in the onResume() method of an Activity (preferably in the main activity of the application).

6.2.3 Impact on performance

The plugin’s impact on the phone’s performance is evaluated by measuring the RAM usage. Two evaluations are conducted, one in a controlled environment and one during real-world usage of the phone.

6.2.3.1 90 minutes controlled experiment

In this evaluation, the RAM usage is measured in intervals when the plugin is running on the phone for 90 minutes. The beacons are turned on and off frequently during the evaluation, which means that the beacons are consumed constantly. One reason for the evaluation is to assert that the RAM used by the plugin will not affect the performance of the phone during an active period. Another reason for the evaluation is to get an overview of how much the RAM usage of the plugin varies during an active period. In this case, an active period means a period when beacons are consumed constantly. The result of the evaluation is displayed in diagram 6.2.3.1, where the graph displays the change in RAM usage during the execution of a plugin. The dots in the graph shows each measurement.

11 “Maven is a software project management and comprehension tool” [73]

Page 61: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

51

Diagram 6.2.3.1 - The change in RAM usage when running the plugin The results of the evaluation show that the RAM usage, when running the plugin for 90 minutes, does not exceed 15 MB. The highest RAM usage was 14.27 MB and the lowest RAM usage was 10.85 MB, which shows that the range is 3.42 MB.

6.2.3.2 12 hours real-world environment

In this evaluation, the plugin is running on the phone for 12 hours and then measurement of current RAM used by the plugin is taken. Beacons are toggled a few times during the day. By doing this, it can be concluded if the memory is growing during a long period of usage. This evaluation is therefore done to assert that the plugin does not have any major memory leaks. A memory leak is when an application does not release unused memory properly. This often leads to that the RAM usage grows with time. At the beginning of the evaluation, the current RAM usage was 11.3 MB. After 12 hours, the current RAM usage was 7.25 MB. This result indicates that the plugin does not have any major memory leaks. One observation done during the evaluation showed that the memory usage has been growing, but then has decreased. Since the memory usage decreased after growing, the growth is not an indication of a memory leak.

6.2.4 Impact on battery life

To evaluate the plugin’s impact on the battery life of a smartphone, two evaluations are conducted.

6.2.4.1 One hour controlled experiment

In this experiment, the phone is not used actively and the test environment is controlled. The first measurement is done by letting the plugin run on the phone and toggle the beacons every five minutes. The second measurement is

Page 62: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

52

done by not using the beacon plugin. The evaluation was done on a Samsung Galaxy S7 in flight mode. The WiFi, location and Bluetooth was turned on since it is a requirement for the plugin to run. Notifications was turned off so they would not have an impact on the test result. The two measurements are then compared to estimate the plugin’s impact on battery life. The result is measured by observing the battery display of the phone. In the first measurement, the initial battery life was 82 percent. After 1 hour with running the plugin, the battery life was 81 percent. The battery life therefore changed with 1 percentage points. In the second measurement, the initial battery life was 81 percent. After 1 hour without running the beacon, the battery life was 80 percent. The battery life therefore changed with 1 percentage points. The battery life changed with the same percentage points in both measurements. This indicates that the running plugin does not have a huge impact on the battery life on the phone.

6.2.4.2 Eight hours empiric test

This evaluation focuses on empirical imprecision of the test person. The purpose of the evaluation is to find out if a potential user of the plugin notices any difference. In the first part of the evaluation, the test person uses the phone without the plugin running. In the second part, the test person uses the phone with the plugin running and beacons being in proximity. The evaluation is made during two periods where the test person uses the phone as he or she normally does. The result of the evaluation is that the test person did not notice any differences in battery life, between the two parts.

Page 63: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

53

7 DISCUSSION

In this section, a discussion is provided on the methods used in the study and the results of the case study, in order to answer the research question. The results of the case study are also compared to other possible solutions. Discussion of reliability of the resources, sustainability and ethics of the study is also provided. The study’s contributions and future research are mentioned.

7.1 Discussion of the methods used

As mentioned in chapter 3, different methods have been used in order to answer the research question of the study. In this section, a discussion is provided of methods used to perform the study.

7.1.1 Data collection

The literature study was very helpful in increasing the knowledge needed to perform the study. A lot of the information found were technical, but information was also found about methods to use for the study. The literature study was conducted without planning on what type of material should be read and where to find the material. This was a bad practice since the material was read in a less controlled way. Therefore, the reading was less effective and important material could have been excluded from the literature study. In the literature study, the reading of different sources was split among the students. One benefit of this method was that information was gathered in a more effective way. One disadvantage was that less discussions were made on the sources read. A discussion could have led to a deeper understanding of the material. Another method used for the literature study was to look for sources related to the study and then structure the sources and the related findings in a document. The look-up was done on KTH library, and in official documentations, such as Android developer documentation. The practice of structuring all the findings in a document was a successful method, since no knowledge was forgotten and the knowledge acquired was easily navigated. To get better practical understanding of the concepts, experiments have been done. As is usually done in engineering, a bigger problem is divided into small distinct parts and solved by the parts. The same thinking with the experiments, dividing the bigger experiment into smaller, worked out very well and each experiment gave extensive understanding of each concept. Experiments were done with purpose of exploration and was not well structured, which made it possible to adapt the experiments as new information was acquired. Here, structured means that there was no preparation or special environment, but only a goal to get a better understanding of a certain concept.

Page 64: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

54

This approach gave a great and deep understanding of each concept and by some degree, the experiments gave hints to the answer of the research question before the case study had been performed.

7.1.2 Implementation

In the case study, there were two phases: the design phase and the implementation. The division into two phases, made it possible to firstly concentrate only on design without thinking about coding details and later concentrate on writing good code. The approach of spending most of the time on the design before the actual implementation was well chosen and gave a great result. The implementation itself took just over two days and only minor changes to the design have been done during that time. The implementation was easy to implement and the case study was performed without any large problems. The TDD approach was a good choice for the implementation, since it made changes easy to implement. It also added confidence that the product was working as intended. Logs were one of the most important tools for checking the application’s flow, finding bugs and performing the evaluation.

7.1.3 Evaluation

The tools used for evaluating the functional requirements was log messages written by plugin during the execution and a checklist of the requirements. The log messages in the implementation were used to evaluate if the requirements were fulfilled. As all the different parts of the implementation were evaluated when integrated together, it was easy to conclude that the functional requirements were fulfilled. The checklist also gave a nice overview of the requirements. Therefore, this method was effective for this study. The non-functional requirements for the case study were measured using multiple evaluations. The evaluations were done in order to measure the simplicity of integrating the plugin in an application, the performance of the application and its impact on the phone’s battery life. Three of the evaluations were done in a more controlled approach with clear input parameters and a clear output. Two of the evaluations were done in a less controlled approach, where there were no restrictions and the observation was done in an empirical way. The benefit of using the more controlled approach was that the result was easier to display and gave a stricter result. The benefit of using the less controlled approach was that it gave a better understanding of the real-world situations when using the plugin. One disadvantage of using the less controlled approach is that the measurements can be considered less reliable, since they only are made by the observer’s subjective views. The two different approaches suit best for different types of evaluation. All the evaluations in the study were measured using the approach that was considered best suited for each particular evaluation and therefore the methods were effective. One disadvantage of the evaluation performed in the case study, is that only one phone has been used for the evaluations. It would be better to perform evaluations on several devices with different battery capacity, different usage

Page 65: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

55

and different RAM capacity. Another disadvantage is that only one test person where used in the empirical battery evaluation. It would be better to perform evaluation with several people, since the devices and usage would vary. The evaluations provided results of the case study, that are used in the following sections to answer the research question.

7.2 Discussion of the results

The result of the case study shows that the plugin can be a viable option in a few cases. If the goal is to perform retargeting using beacons and a new application is not an option, the plugin for retargeting can be used. This solution eliminates the need for a customized application and performs retargeting in the background. If an advertising company, that wants to use this kind of plugin, has a lot of partners that already have popular applications, it would be a good solution to use. The evaluations showed that the plugin is memory and battery efficient and not much extra work is needed to integrate and launch it from an existing application. The plugin itself does not require a lot of RAM memory, which indicates that both modern and a few years old phones will not be significantly affected. Observations done in the evaluation, showed that memory usage grows and drops over time. One possible explanation is that one of the frameworks might save the information and then sending it when it finds appropriate, instead of making many network calls that affect battery life negatively. To point out the cause of the memory growth, a separate research has to be done and is not included in this thesis. The battery life is not significantly affected by the plugin. The battery life can suffer in the future if there would be a great number of beacons in the same place. A few improvements can be done to the application to decrease the impact of the battery life, but they are not covered in this thesis.

7.3 Comparison with other solutions

There are other solutions that can be used for online advertising using beacons. Some of them were found during the literature study and some have been tested during the experiment phase. In this section, the solution presented in the case study is compared to the other solutions.

7.3.1 Application only

One way of using beacons is having an application that can listen to beacons and make use of the signals. An example of that is Major League Baseball and “At the Ballpark” application that helps spectators to find their seats using beacons, as mentioned in chapter 2. This is the simplest solution for an enterprise that already has a popular application installed on many devices. The problem with using this solution for online advertising, is that it is difficult to make people download the application only for advertising. This compared to the plugin developed in the case study, where the user does not have to

Page 66: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

56

download a new application, but only update the one they already use. This makes the plugin a more suitable solution.

7.3.2 Plugin with notifications

If the goal is to show different deals currently available in the proximity, notifications can be used. As already mentioned, a separate application is not the best solution for every enterprise. Instead, a plugin just as in the case study can be created, but for issuing notifications instead of retargeting. That plugin would receive signals from beacons and display a notification about a deal nearby. There exists a legal issue with this solution. Google has set up rules to prevent Android applications to use advertisement, that are not related to the application, in the notifications. Therefore, the solution is limited to showing only the advertisement for specific applications and cannot be used as a plugin in other applications. There are also existing alternatives that provide notifications with advertisement which are described in the following section.

7.3.3 Physical web and Estimote Here & Now

As mentioned before, Physical web, is Google's “[...] open approach to enable quick and seamless interactions with physical objects and locations”. [24] By using Physical Web, it is possible to receive signals from beacons and show silent notifications. A silent notification is a notification that does not cause the system to alert the user about the notification by any sound, vibration or popup. When a user clicks on the notification, they are redirected to the browser and a web page with advertisement. Here & Now is an Estimote service that is built on top of the Physical Web and provides an easy way of defining the messages and URL:s that will be used in the notification. This is a simple way to use beacons for advertising, without any need of creating a new application. It is also possible to perform retargeting by defining a URL that user will go to when clicking on a notification. The problem is that if user does not click, no retargeting will be performed. The plugin in the case study does not have that kind of drawback. The reason for this is that it is constantly running in the background and is not triggered by a user click, except for the initial launch.

7.3.4 Physical web with retargeting plugin

To solve the problem of not being able to perform a complete retargeting with Physical Web as mentioned in the previous section, both Physical Web and a plugin can be used. That solution means that there would be two running processes that are looking for beacons. In the experiment in section 4.2.8, a way of reducing that kind of double work was tested, but the test shows that the solution is impractical due to Android security. The practical way currently to perform both complete retargeting and the notification advertisement, is to have the plugin in the case study together with the Physical web or to perform the non-complete retargeting. In this case, non-complete retargeting means performing the retargeting as mentioned in the

Page 67: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

57

previous subsection i.e. retargeting that is performed only if the user clicks on the notification and the website is loaded.

7.4 Research sources

In this thesis, most of the information sources are official documentations. Example of these are Android development documentation, Estimote’s guide on beacons or Bluetooth official specification. The official documentation is the often the best source of information, since it is written by those who created the tools or products. Therefore, they are assumed to have the best understanding of the subject. For retargeting and some advertisement information, informational blogs are used. Information from blogs should be read critically, since there could be authors personal opinions or the author might not be an expert on the subject. A good way to validate the information is to check in multiple location is the information is correct. It is more likely that information is valid, if it can be found at multiple sources. In the case of retargeting and advertisement, Adoveo and the blogs provided similar information, which makes the information more valid.

7.5 Sustainability

The solution is simple to manage by future developers, since the implementation is documented and the code is written with manageability in mind. This decreases the amount of work needed to manage the implementation. The solution is also written in a general fashion in order to accommodate possible future changes. The future of beacon technology looks bright, since IoT is growing more and more, which indicates that the solution, implemented in the case study, can be used in the following years. Because of the plugin’s low impact on battery life, the phone does not need to be charged more often. The beacons that are consumed by the plugin has a long battery life and do not need to be changed very often. Therefore, the implementation is sustainable considering environmental aspects. The solution saves time for the application developers, since they can import the plugin and launch it and does not have to design and implement it themselves. By saving working time, less computers and electricity have to be used, and that way the solution does not have a big negative effect on the environment.

Page 68: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

58

It is also possible that the solution indirectly will have a negative impact on the environment. The reason for this is that retargeting can increase the conversion rate for the company that makes use of the retargeting. That way, the potential customers will consume more products, which can have a negative impact on the environment. One example of this is that an advertised product may not be produced using environment friendly methods.

7.6 Ethics

One ethical aspect of this study is the integrity of a user that uses the plugin implemented in the case study. Geographic information is stored about the user when entering a beacon region. This can be an issue if the user does not want to share that information. This potential issue is solved by asking the user for permissions to use his or her geographic location and mention the information gathering in the policy of the application. That way, the user agrees to sharing his or her geographic information and knows about which information gathering is done. All the collected user information is anonymous. The reason for this is that the user identifier (which is the only user information currently collected) is a random value and not a piece of personal information, for example user’s e-mail address. That is ethically good because users do not have to share any personal identification information.

7.7 Contribution

This study contributes with knowledge to the field of online advertisement with beacons. The contribution is knowledge of a new solution that can be used when consuming beacons for online advertising and how usable it is compared to other solutions. This knowledge can be considered when future research is done in the research area. The knowledge can also be used by companies when choosing on which solution to implement for making use of beacons in their online advertising.

7.8 Future research

Future research using the case study could be done to find out why the plugin in the case study grows in memory and might replace problematic frameworks. Another future research that can be conducted is to find out if there is simpler solutions for online advertisement using beacons than those existing today. One example would be to find a way to use Physical Web to listen for beacons, instead of building a listener for them, as done in the case study. Another example of that, is to find an effective way to combine notifications and retargeting, for performing online advertising using beacons.

Page 69: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

59

9 REFERENCES

[1] iBeacon - Frequently Asked Questions. (2014). 1st ed. [ebook] Cisco. Available at: http://www.cisco.com/c/dam/en/us/solutions/collateral/enterprise-networks/connected-mobile-experiences/ibeacon_faq.pdf [Accessed 23 Mar. 2017]. [2] Andersson, A. and Runbert, J. (2015). Cross-platform Mobile Development and Internet of Things. 1st ed. [ebook] pp.10-11. Available at: http://www.diva-portal.org/smash/get/diva2:890376/FULLTEXT01.pdf [Accessed 23 Mar. 2017]. [3] Support Center. What is the range of each beacon?. [online] Available at: https://support.kontakt.io/hc/en-gb/articles/201349702-What-is-the-range-of-each-beacon- [Accessed 24 Mar. 2017]. [4] Android Developers. (2017). Dashboards. [online] Available at: https://developer.android.com/about/dashboards/index.html [Accessed 27 Mar. 2017]. [5] Developer.apple.com. (2017). WWDC 2017 - Apple Developer. [online] Available at: https://developer.apple.com/wwdc/ [Accessed 27 Mar. 2017]. [6] Getting Started with iBeacon. (2014). 1st ed. [ebook] Apple, p.2. Available at: https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf [Accessed 27 Mar. 2017]. [7] Estimote Community Portal. (2017). What is a beacon protocol? Can beacons broadcast multiple packets simultaneously?. [online] Available at: https://community.estimote.com/hc/en-us/articles/208546097-What-is-a-beacon-protocol-Can-beacons-broadcast-multiple-packets-simultaneously- [Accessed 27 Mar. 2017]. [8] Google Developers. (2017). Beacons | Google Developers. [online] Available at: https://developers.google.com/beacons/ [Accessed 27 Mar. 2017]. [9] Adoveo.com. Adoveo - Engaging video ads. [online] Available at: http://adoveo.com/ [Accessed 28 Mar. 2017]. [10] Estimote. Estimote Beacons. [online] Available at: https://estimote.com/ [Accessed 28 Mar. 2017]. [11] Marketing Terms. (2017). What is a Banner Ad? - Definition & Information. [online] Available at: http://www.marketingterms.com/dictionary/banner_ad/ [Accessed 28 Mar. 2017].

Page 70: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

60

[12] Android Developers. (2017). Bluetooth Low Energy. [online] Available at: https://developer.android.com/guide/topics/connectivity/bluetooth-le.html [Accessed 28 Mar. 2017]. [13] Google Developers. (2017). Eddystone format | Beacons | Google Developers. [online] Available at: https://developers.google.com/beacons/eddystone [Accessed 28 Mar. 2017]. [14] Estimote Community Portal. (2015). What are nearables? What is Nearable protocol?. [online] Available at: https://community.estimote.com/hc/en-us/articles/206409488-What-are-nearables-What-is-Nearable-protocol- [Accessed 28 Mar. 2017]. [15] Google Developers. (2017). Eddystone Ephemeral Identifier | Beacons | Google Developers. [online] Available at: https://developers.google.com/beacons/eddystone-eid [Accessed 28 Mar. 2017]. [16] Murray, R. (2003). Blending qualitative and quantitative research method in theses and dissertations. 1st ed. [ebook] Thousand Oaks, California: Corwin Press, Inc, pp.1-2. Available at: https://books.google.se/books?id=qx-yzSILfbMC&printsec=frontcover&dq=qualitative+and+quantitative+research&hl=sv&sa=X&ved=0ahUKEwiQ58HxtvvSAhVCESwKHe4qBJwQ6AEIJDAB#v=onepage&q&f=true [Accessed 31 Mar. 2017]. [17] IEEE Spectrum: Technology, Engineering, and Science News. (2015). Why IoT Needs 5G. [online] Available at: http://spectrum.ieee.org/tech-talk/computing/networks/5g-taking-stock [Accessed 30 Mar. 2017]. [18] Ericsson Mobility Report. (2016). [online] Stockholm: Ericsson. Available at: https://www.ericsson.com/assets/local/mobility-report/documents/2016/ericsson-mobility-report-november-2016.pdf [Accessed 30 Mar. 2017]. [19] Christensson, P. (2006). Plug-in Definition. [online] Techterms.com. Available at: https://techterms.com/definition/plugin [Accessed 31 Mar. 2017]. [20] Developer.estimote.com. (n.d.). What is Eddystone?. [online] Available at: http://developer.estimote.com/eddystone/ [Accessed 4 Apr. 2017]. [21] Bluetooth.com. (n.d.). GATT XML | Bluetooth Technology Website. [online] Available at: https://www.bluetooth.com/specifications/gatt [Accessed 4 Apr. 2017]. [22] Bluetooth.com. (n.d.). GATT Services | Bluetooth Technology Website. [online] Available at: https://www.bluetooth.com/specifications/gatt/services [Accessed 4 Apr. 2017]. [23] GitHub. (2016). google/eddystone. [online] Available at: https://github.com/google/eddystone [Accessed 4 Apr. 2017].

Page 71: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

61

[24] Google.github.io. (n.d.). The Physical Web. [online] Available at: https://google.github.io/physical-web/ [Accessed 4 Apr. 2017]. [25] Developer.estimote.com. (n.d.). Beacon Tech Overview. [online] Available at: http://developer.estimote.com/ [Accessed 4 Apr. 2017].

[26] Goldfarb, A. and Tucker, C. (2011). Advances in Computers. 81st ed. [ebook] Elsevier Inc, pp.292 - 303. Available at: http://855145000069/1-s2.0-B9780123855145000069-main.pdf?_tid=3af40d26-1919-11e7-ae68-00000aab0f27&acdnat=1491298361_8a3d1734738279baf25335f9f9fb5842 [Accessed 4 Apr. 2017]. [27] Manifest, A. (n.d.). App Manifest | Android Developers. [online] Developer.android.com. Available at: https://developer.android.com/guide/topics/manifest/manifest-intro.html [Accessed 4 Apr. 2017]. [28] Files, M. (n.d.). Merge Multiple Manifest Files | Android Studio. [online] Developer.android.com. Available at: https://developer.android.com/studio/build/manifest-merge.html [Accessed 4 Apr. 2017].

[29] Chamberlain, L. (2016). GeoMarketing 101: What Is Geotargeting? |.

[online] Geomarketing.com. Available at:

http://www.geomarketing.com/geomarketing-101-what-is-geo-targeting

[Accessed 4 Apr. 2017].

[30] Chamberlain, L. (2016). GeoMarketing 101: What Are Beacons? |.

[online] Geomarketing.com. Available at:

http://www.geomarketing.com/geomarketing-101-what-are-beacons

[Accessed 4 Apr. 2017].

[31] Developer.estimote.com. (n.d.). Connecting to Estimote Beacons. [online] Available at: http://developer.estimote.com/managing-beacons/connecting-to-beacons/ [Accessed 4 Apr. 2017]. [32] Developer.estimote.com. (n.d.). What is Estimote Indoor Location SDK?. [online] Available at: http://developer.estimote.com/indoor/ [Accessed 4 Apr. 2017]. [33] Developer.estimote.com. (n.d.). Estimote Telemetry. [online] Available at: http://developer.estimote.com/sensors/estimote-telemetry/ [Accessed 4 Apr. 2017]. [34] Library, C. (n.d.). Create an Android Library | Android Studio. [online] Developer.android.com. Available at: https://developer.android.com/studio/projects/android-library.html [Accessed 5 Apr. 2017].

Page 72: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

62

[35] Apps, I. (n.d.). Interacting with Other Apps | Android Developers. [online] Developer.android.com. Available at: https://developer.android.com/training/basics/intents/index.html [Accessed 5 Apr. 2017]. [36] Linux.com | The source for Linux information. (n.d.). What is Linux?. [online] Available at: https://www.linux.com/what-is-linux [Accessed 5 Apr. 2017]. [37] Android Developers. (n.d.). Application Fundamentals. [online] Available at: https://developer.android.com/guide/components/fundamentals.html [Accessed 5 Apr. 2017]. [38] Anderson, J. (2017). What's the battery life of Estimote Beacons? Can I optimize it?. [online] Estimote Community Portal. Available at: https://community.estimote.com/hc/en-us/articles/202552866-What-s-the-battery-life-of-Estimote-Beacons-Can-I-optimize-it- [Accessed 6 Apr. 2017]. [39] Bluetooth.com. (n.d.). Bluetooth Low Energy | Bluetooth Technology Website. [online] Available at: https://www.bluetooth.com/what-is-bluetooth-technology/how-it-works/low-energy [Accessed 7 Apr. 2017]. [40] Estimote Community Portal. (n.d.). What is Estimote Cloud?. [online] Available at: https://community.estimote.com/hc/en-us/articles/203854516-What-is-Estimote-Cloud- [Accessed 7 Apr. 2017]. [41] Docs.gradle.org. (2017). Introduction - Gradle User Guide Version 3.4.1. [online] Available at: https://docs.gradle.org/3.4.1/userguide/introduction.html [Accessed 7 Apr. 2017]. [42] Bluetooth Low Energy Beacons. (2016). 1st ed. [ebook] Dallas, Texas: Texas Instruments Incorporated, pp.7-8. Available at: http://www.ti.com/lit/an/swra475a/swra475a.pdf [Accessed 10 Apr. 2017]. [43] Bluetooth.com. (n.d.). Technical Considerations | Bluetooth Technology Website. [online] Available at: https://www.bluetooth.com/specifications/bluetooth-core-specification/technical-considerations [Accessed 10 Apr. 2017]. [44] Bluetooth Low Energy Beacons. (2016). 1st ed. [ebook] Dallas, Texas: Texas Instruments Incorporated, p.2. Available at: http://www.ti.com/lit/an/swra475a/swra475a.pdf [Accessed 10 Apr. 2017]. [45] Andersson, A. and Runbert, J. (2015). Cross-platform Mobile Development and Internet of Things. 1st ed. [ebook] pp.13-14. Available at: http://www.diva-portal.org/smash/get/diva2:890376/FULLTEXT01.pdf [Accessed 11 Apr. 2017].

Page 73: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

63

[46] Android Open Source Project. (2017). The Android Source Code | Android Open Source Project. [online] Available at: https://source.android.com/source/ [Accessed 11 Apr. 2017]. [47] Wells, D. (2009). Agile Software Development: A gentle introduction.. [online] Agile-process.org. Available at: http://www.agile-process.org/ [Accessed 12 Apr. 2017]. [48] Wells, D. (2009). Extreme Programming Rules. [online] Extremeprogramming.org. Available at: http://www.extremeprogramming.org/rules.html [Accessed 12 Apr. 2017]

[49] Wells, D. (2009). Pair Programming. [online] Extremeprogramming.org. Available at: http://www.extremeprogramming.org/rules/pair.html [Accessed 12 Apr. 2017].

[50] Sommerville, I. (2011). Software engineering. 1st ed. Boston, Massachusetts: Addison-Wesley, pp.211, 221 - 222.

[51] Socha, W. (2017). What are Estimote Stickers?. [online] Estimote Community Portal. Available at: https://community.estimote.com/hc/en-us/articles/203323543-What-are-Estimote-Stickers- [Accessed 12 Apr. 2017]. [52] Developer.android.com. (2017). Meet Android Studio | Android Studio. [online] Available at: https://developer.android.com/studio/intro/index.html [Accessed 12 Apr. 2017]. [53] Indoor Positioning System based on Bluetooth Low Energy for Blind or Visually Impaired Users. (2015). 1st ed. [ebook] Stockholm: KTH Royal Institute of Technology. Available at: https://people.kth.se/~maguire/DEGREE-PROJECT-REPORTS/151018-Tengqingqing_Ge-with-cover.pdf [Accessed 12 Apr. 2017]. [54] Bryman, A. and Bell, E. (2015). Business Research Methods. 3rd ed. [ebook] Oxford: Oxford University Press, p.37. Available at: https://books.google.se/books?id=l7u6BwAAQBAJ&lpg=PP1&ots=AvTitbJPQl&dq=thesis%20research%20methods&lr&hl=sv&pg=PP1#v=onepage&q=thesis%20research%20methods&f=false [Accessed 13 Apr. 2017]. [55] Getadblock.com. (n.d.). AdBlock. [online] Available at: https://getadblock.com/ [Accessed 13 Apr. 2017]. [56] Oxford Dictionaries. (n.d.). Definition of evaluation in English | Oxford Dictionaries. [online] Available at: https://en.oxforddictionaries.com/definition/evaluation [Accessed 13 Apr. 2017]. [57] GitHub. (2017). Estimote/Android-SDK. [online] Available at: https://github.com/Estimote/Android-SDK/blob/master/Docs/DOC_monitoring_scanning.md [Accessed 25 Apr. 2017].

Page 74: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

64

[58] Facebook for Developers. (n.d.). Access Tokens, Facebook Login. [online] Available at: https://developers.facebook.com/docs/facebook-login/access-tokens/ [Accessed 25 Apr. 2017]. [59] Google Developers. (2016). Getting Profile Information | Google Developers. [online] Available at: https://developers.google.com/identity/sign-in/android/people [Accessed 25 Apr. 2017]. [60] Facebook for Developers. (n.d.). Permissions, Facebook for Developers. [online] Available at: https://developers.facebook.com/docs/facebook-login/permissions/overview [Accessed 25 Apr. 2017]. [61] Developer.android.com. (n.d.). Remembering Your User | Android Developers. [online] Available at: https://developer.android.com/training/id-auth/identify.html [Accessed 25 Apr. 2017]. [62] Developer.android.com. (n.d.). Requesting Permissions | Android Developers. [online] Available at: https://developer.android.com/guide/topics/permissions/requesting.html [Accessed 25 Apr. 2017]. [63] Build, C. (n.d.). Configure Your Build | Android Studio. [online] Developer.android.com. Available at: https://developer.android.com/studio/build/index.html [Accessed 25 Apr. 2017]. [64] Docs.oracle.com. (n.d.). Calendar (Java Platform SE 7 ). [online] Available at: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html [Accessed 25 Apr. 2017]. [65] Developer.android.com. (n.d.). Build | Android Developers. [online] Available at: https://developer.android.com/reference/android/os/Build.html [Accessed 25 Apr. 2017]. [66] Docs.oracle.com. (n.d.). HashMap (Java Platform SE 7 ). [online] Available at: https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html [Accessed 25 Apr. 2017]. [67] W3schools.com. (n.d.). HTTP Methods GET vs POST. [online] Available at: https://www.w3schools.com/tags/ref_httpmethods.asp [Accessed 25 Apr. 2017]. [68] Uml.org. (2005). What is UML | Unified Modeling Language. [online] Available at: http://www.uml.org/what-is-uml.htm [Accessed 25 Apr. 2017]. [69] Files, M. (n.d.). Merge Multiple Manifest Files | Android Studio. [online] Developer.android.com. Available at: https://developer.android.com/studio/build/manifest-merge.html#override_wzxhzdk35uses-sdk_for_imported_libraries [Accessed 26 Apr. 2017].

Page 75: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

65

[70] Ociepa, R. (2017). What's Estimote Here & Now?. [online] Estimote Community Portal. Available at: https://community.estimote.com/hc/en-us/articles/115001034908-What-s-Estimote-Here-Now- [Accessed 2 May 2017]. [71] Reality matters. (2016). Estimote introduces Here & Now - the messaging technology for the physical world. [online] Available at: http://blog.estimote.com/post/148498710120/estimote-introduces-here-now-the-messaging [Accessed 2 May 2017]. [72] GitHub. (n.d.). FasterXML/jackson. [online] Available at: https://github.com/FasterXML/jackson [Accessed 21 May 2017]. [73] Porter, B., Zyl, J. and Lamy, O. (2017). Maven – Welcome to Apache Maven. [online] Maven.apache.org. Available at: https://maven.apache.org/ [Accessed 29 May 2017]. [74] WhatIs.com. (n.d.). What is framework? - Definition from WhatIs.com. [online] Available at: http://whatis.techtarget.com/definition/framework [Accessed 13 Jun. 2017]. [75] SearchCIO. (n.d.). What is data management platform (DMP)? - Definition from WhatIs.com. [online] Available at: http://searchcio.techtarget.com/definition/data-management-platform-DMP [Accessed 13 Jun. 2017]. [76] Håkansson, A. (2013). Portal of Research Methods and Methodologies for Research Projects and Degree Projects. [online] Kth.se. Available at: https://www.kth.se/social/files/55563b9df27654705999e3d6/Researc [Accessed 13 Jun. 2017].

Page 76: Beacons for online advertising - kth.diva-portal.org1119063/FULLTEXT01.pdf · Beacons are small devices that can broadcast messages using Bluetooth and other communication technologies

TRITA TRITA-ICT-EX-2017:45

www.kth.se