Profile-Based Ad Hoc Social Networking Using Wi-Fi Direct on the Top of Android

Ad-hoc Social Networks have become popular to support novel applications related to location-based mobile services that are of great importance to users and businesses. Unlike traditional social services using a centralized server to fetch location, ad-hoc social network services support infrastructure less real-time social networking. It allows users to collaborate and share views anytime anywhere. However, current ad-hoc social network applications are either not available without rooting the mobile phones or don't filter the nearby users based on common interests without a centralized server. This paper presents an architecture and implementation of social networks on commercially available mobile devices that allow broadcasting name and a limited number of keywords representing users' interests without any connection in a nearby region to facilitate matching of interests. The broadcasting region creates a digital aura and is limited by WiFi region that is around 200 meters. The application connects users to form a group based on their profile or interests using peer-to-peer communication mode without using any centralized networking or profile matching infrastructure. The peer-to-peer group can be used for private communication when the network is not available.


Introduction
Online social networks, for example, Facebook, LinkedIn, or Twitter, are now highly popular among people, and the trend to use the social networking applications on the mobile device is continuously increasing. e pattern of using social networking on the mobile device is being exploited by researchers and service providers to provide location-based social networking [1][2][3]. Examples of location-based social networking include the Facebook's feature to find exotic locations or friends nearby in a geographical region. However, current social networking applications do not provide location-based services without accessing the present site of a user, and many users consider this a privacy risk. Furthermore, limited data plans for the mobile device and high cost of international roaming constraint users to communicate even in the nearby region. us, the current trend is to decentralize the online social network [4].
Ad hoc social network, one-to-one or multipeer connection, can solve this problem of privacy and help facilitate the communication in a nearby region without using the centralized infrastructure. ere are numerous applications; for example, it may also be useful in a business meeting where the distribution of physical business cards is not a convenient method, but the e-cards can be conveniently distributed in a peer-to-peer network to all individuals present nearby. Another application is communication among passengers in an airplane for game playing by children especially when the flight duration is long or for anonymous chatting among interested passengers or with crew members. Furthermore, ad hoc social network can help to communicate in case of natural disasters or government censorship.
Ad hoc wireless peer-to-peer technology connects devices to create a communication group for social interaction.
is paper presents a Wi-Fi peer-to-peer-based mechanism called OffAT (OFFline chAT) [5] that helps to find people with similar interests in a nearby region [1,6,7] and allows sharing text or handwritten messages without any centralized server. e mechanism can be used to further develop  applications to cater needs of business users to distribute  business cards during international conferences, seminars,  or meetings for networking when people may have smartphones but do not have access to the Internet. is paper is organized as follows: Section 2 provides the review of related publications. Section 3 provides research motivation. Section 4 provides architecture and implementation comprising key components used for locationbased ad hoc social networking. Section 5 provides results and analysis.

Related Work
e ad hoc social network (ASN) has the potential to connect nearby users who should be connected based on similar interests. Eagle and Pentland [8] introduced a service to introduce proximate users by doing profile matching at a central server. e service alerted users of similar interests in a nearby region. Zhang et al. [9] introduced the multihop social network to broadcast promotional offers to nearby users without using the Internet or GPS. e authors used the dynamic source routing ad hoc network protocol to deploy the multihop social network. Zhang et al. [10] considered ASN as the extension of the online social network to further increase global communication.
e authors provided an architecture comprising four layers, namely, application, community, network, and device layers. e functions of profile management were implemented in the community layer. Wang et al. [11] implemented the peer-to-peer social network based on Wi-Fi Direct to facilitate communication among nearby users without a centralized infrastructure.
Some researchers have also presented middleware solutions; for example, Aneja and Gambhir [12] published a four-layer architecture with application, transport, ad hoc social, and ad hoc communication layers. Similarly, Bellavista and Giannelli [13] proposed the spontaneous multihop network using a three-layer architecture including the IP layer, spontaneous multihop layer, and semantic dispatching layer. e architecture uses a one-hop network and makes use of the dispatching layer to deliver packets to other nodes without knowing the destination. Bottazzi et al. [14] presented the socially aware and mobile architecture that provides the roaming social network and groups proximate users with similar interests.
Rahman and Hossain [15] developed nine mobile applications using a massive ad hoc social network. e applications are based on Wi-Fi, 4G, Wi-Fi Direct, and other emergency Internet access points. e mobile apps provide nearby services and tools to contact social friends based on the current context and previous history. Ilkhechi et al. [16] provided the decentralized location service scheme that can be used to identify the location in the ad hoc network. e nodes first obtain knowledge of surroundings, and the location of the target is computed based on the knowledge.
Shu et al. [17] presented Talk2Me that is a device-todevice augmented reality social network and allows people to exchange messages with nearby users. Casetti et al. [18] discussed inter-and intragroup communication technologies using the Wi-Fi Direct protocol. e number of nodes in one group that can participate in the communication depends on the IP class addressing scheme; however, Casetti et al. [18] provided a mechanism to extend the group and the range of the network by having multigroup communication. e multigroup is created by allowing a group owner to become a legacy client or a relay client in another group. However, the groups formed with clients are general groups without doing profile or interests matching. e probability of clients leaving may be high when they do not see interests being matched in the group. erefore, prior published works have solved issues related to profile matching at a central server and have been able to provide communication among nearby users without profile matching. As a result, there is a need for a system and a method that provide profile matching of nearby users without using the Internet or central server and allow sharing text or files with the matched users.

Research Motivation
Most portable mobile devices today are equipped with Wi-Fi Direct, Bluetooth, and Wi-Fi short-range wireless technologies which can support spontaneous on-the-go social networking by connecting users with similar interests using the ad hoc communication mode. Wi-Fi Direct or P2P technology allows devices to connect to each other to form groups. e devices negotiate roles, and one of them becomes the group owner, and the other devices connect to the owner as a client device. e devices use their MAC address as their device ID for discovery and communication and a temporary MAC address for all frames within a group.
Although direct device-to-device connectivity via the ad hoc mode was available in IEEE 802.11, it is still not widely available in the devices. Furthermore, 802.11z, Tunneled Direct Link Setup enables device-to-device communication, but devices need to be associated with the same access point. Wi-Fi P2P is based on the IEEE 802.11 infrastructure technology, but devices negotiate, and one of the devices becomes the soft access point. In other words, Wi-Fi P2P does not need a centralized fixed physical infrastructure, and any device with Wi-Fi Direct enabled can participate in the negotiation. Wi-Fi Direct or P2P specification is still at an early stage, and the many researchers have started implementing the technology. e proposed social networking protocol and implementation, OffAT, provides social applications including interests similarity and communication between similar users that has been built using Wi-Fi Direct in the commercially available devices. OffAT allows users to broadcast user's interests in a nearby region without using any centralized infrastructure and performs interests similarity matching and calculates profile similarity to assist users in finding a person of similar interests nearby.

Architecture and Implementation
e main components of the proposed mechanism are device discovery, interest-based social network, and intergroup communication.

Device Discovery.
Wi-Fi Direct devices discover each other using device discovery, wherein a P2P device selects a listen channel and alternates between the search state and listen state. e time for each state is allocated randomly between 100 ms and 300 ms but can be configured. Some researchers have used MAC ID as the device ID in the discovery process or some confidential ID that limits to connect with only a specified user [19] or using an Internet connection [20,21]. For example, MobiClique [22] used Bluetooth for device discovery to locate nearby users and a central server for matching the user profiles. Profile matching at a central server is only feasible in some cases due to the additional requirement of the server or infrastructure. e proposed method in this paper provides the mechanism and user interface to configure device ID as user name#user interests. e device ID by default is MAC address and is broadcasted as SSID in the nearby region. is paper proposes an implementation of changing device ID to user name#user interests so that interests can be broadcasted in the nearby region. e total length of name#user interests is restricted to 32 characters as per the IEEE standard for the length of SSID [23]. e broadcasted interests can be representative keywords to be used as the first layer to filter users before actual connection. e representative keywords can be the most frequent keywords that appear in users' prior actions including browsing history.
Using device ID to match user interests helps to reduce network overhead of establishing a social network of users who are not similar to each other and likely to not involve in social applications. e below code explains the methodology used to extract user ID and interests in MainActivity.java and set the device ID as user name and interests in WiFiDirectActivity.java in Java (Algorithm 1). Figure 1 displays a user interface to configure device ID. Interests are automatically separated in the backend as a list of keywords based on space or comma operator as shown in the code. Modifying device ID to interests solves the following purposes: (1) All user devices can access interests of other users without any centralized infrastructure (2) Device can compute interests similarity and can decide whether to connect with other users or not (3) Computed similarity can also be used to accept or reject any incoming connection request (4) Reduces network overhead due to exchanging profiles A device can have two statuses such as available or connected. A connected device can either be a group owner or an existing group member. Figure 2 shows the device discovery phase and displays the device status as available.   Mobile Information Systems

Profile Matching.
e profile matching is the core of social networking, especially location-based social networking. Figure 3(a) displays a user device with device ID as user name#interests as available along with nearby available devices, and Figure 3(b) displays a user connected with user2. e discovery process can be manually started by clicking the hand icon available below user name and interests in case no user is found. e OffAT scans interests of nearby users and computes profile similarity based on matched keywords. e option to send a request to a neighboring user, preferably a user with high profile similarity, is displayed along the right side of each user. e list of users can quickly be scrolled to see all users if the number of users is high. Once the other user accepts the connection request, the status of both users will get connected as shown in Figure 3(b). e option to chat or disconnect and start the connection or discovery phase is displayed to the connected user as shown in Figure 3(b).
A number of researchers proposed creating the weighted profile from the user browsing history and/or prior user action [6,24] and cosine similarity to match the profiles. e cosine similarity of two user profiles varies between 0 and 1. Cosine similarity is 1 when the angle is 0 meaning the two profiles are exactly the same. In a vector space model [24], a user profile is represented by p 1 , p 2 , . . . , p n , where the elements are different keywords. A union of all keywords of profiles is considered before computing cosine similarity. e weights represent the number of times a word appears in a browsing history or prior user action [6,24]. Gambhir et al. [25] found that cosine similarity is not a correct method especially in case of a weighted profile. For the implementation of the mechanism and simplicity, the profile matching matches keywords to find the profile similarity percentage.

Social Communication.
Once the users are connected based on their profile, they can start chatting or sharing files.
is phase may also be used to add more members to the group by sending a connection request to the server designated in negotiation when the request is sent to connect. OffATalso allows exchanging handwritten notes as shown in Figure 4. Multihop communication can be facilitated by configuring a device as a client as well as a group owner where the device alternates roles based on time-sharing.

Security.
Wireless networks are vulnerable to eavesdropping and intrinsically exposed to both active and passive security attacks. is presents a challenge in the incorporation of key-based cryptographic mechanisms for ad hoc networks because there is no trusted authority to provide certification or a centralized key distributor. Since OffAT mobile devices use Wi-Fi Direct, the security protocol implements WPA2 (Wi-Fi Protected Access II)  (Temporal Key Integrity  Protocol), WPA2 also provides AES (Advanced Encryption Standard) support courtesy of the 64-digit hexadecimal keys (preshared key (PSK)). Communication privacy and security are therefore provided through WPA2 and Wi-Fi Direct. is implementation enables users to maintain privacy because the users can share user ID and limited interests without disclosing their e-mail ID or phone number unless they want to explicitly and are at liberty to decline linking requests (invitations) from other nearby users or disconnect. Furthermore, the connection requests are automatically declined after 30 seconds when the request is not responded.
is preventive mechanism further protects data integrity by authenticating sources and sequencing of messages.

Results
e app, available at Google Play Store [5], is developed for the Android platform to simulate the proposed ASN. e screenshots shown in this paper are from two devices (Nexus 6P) with one device in the airplane mode and the other using the telecommunication network and also connected to a Wi-Fi router in addition to participating in the ad hoc social network. During implementation and testing, it was observed that switching on Wi-Fi is required to participate in Wi-Fi Direct communication. erefore, there is a limitation in the airplane mode to manually switch on the Wi-Fi without even being connected to any centralized infrastructure. Although Android allows activating Wi-Fi programmatically, testing results with users indicated that this is not better since it sometimes delays the process of reconfiguring device ID. Furthermore, asking users to manually switch on Wi-Fi provides the time that an app needs to modify the device ID with user ID and interests. e users are able to exchange text and handwritten notes among other nearby similar users without any centralized network infrastructure. Implementation results and feedback posted at Google Play Store indicated user preferences towards location-based social networking. ere are few suggestions by users to fix user name and interests, and they can be configured by Shared Preferences in the Android. Future work may include to automatically exchange hello packets with nearby or connected users for displaying them as online/offline.

Data Availability
e research paper proposes a mobile app for location-based social networking. e app is available at Google Play Store, and link is available in the references.

Conflicts of Interest
e authors declare that they have no conflicts of interest.