• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.net.wifi.aware;
18 
19 /**
20  * Base class for a listener which is called with the MAC address of the Aware interface whenever
21  * it is changed. Change may be due to device joining a cluster, starting a cluster, or discovery
22  * interface change (addresses are randomized at regular intervals). The implication is that
23  * peers you've been communicating with may no longer recognize you and you need to re-establish
24  * your identity - e.g. by starting a discovery session. This actual MAC address of the
25  * interface may also be useful if the application uses alternative (non-Aware) discovery but needs
26  * to set up a Aware connection. The provided Aware discovery interface MAC address can then be used
27  * in {@link WifiAwareSession#createNetworkSpecifierOpen(int, byte[])} or
28  * {@link WifiAwareSession#createNetworkSpecifierPassphrase(int, byte[], String)}.
29  */
30 public class IdentityChangedListener {
31     /**
32      * @param mac The MAC address of the Aware discovery interface. The application must have the
33      * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} to get the actual MAC address,
34      *            otherwise all 0's will be provided.
35      */
onIdentityChanged(byte[] mac)36     public void onIdentityChanged(byte[] mac) {
37         /* empty */
38     }
39 }
40