Created
June 9, 2022 14:05
-
-
Save molidev8/d8021cc4ef2a17c244278e990c494db9 to your computer and use it in GitHub Desktop.
A function to act as a publisher in Nearby Share
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun startAdvertising() { | |
val advertisingOptions = | |
AdvertisingOptions.Builder().setStrategy(Strategy.P2P_POINT_TO_POINT).build() | |
client.startAdvertising( | |
android.os.Build.MODEL, SERVICE_ID, ConnectingProcessCallback(), advertisingOptions | |
) | |
.addOnSuccessListener { | |
Log.d(GENERAL, "advertising...") | |
} | |
.addOnFailureListener { | |
Log.d(GENERAL, "failure advertising...") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment