Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get wifi ssid or another information? #25

Closed
Djfox936 opened this issue Jan 29, 2022 · 1 comment
Closed

How to get wifi ssid or another information? #25

Djfox936 opened this issue Jan 29, 2022 · 1 comment
Labels
question Further information is requested

Comments

@Djfox936
Copy link

This is the method provided in google MLKit
case Barcode.TYPE_WIFI:
String ssid = barcode.getWifi().getSsid();
String password = barcode.getWifi().getPassword();
int type = barcode.getWifi().getEncryptionType();
break;
case Barcode.TYPE_URL:
String title = barcode.getUrl().getTitle();
String url = barcode.getUrl().getUrl();
break;
How can I use this method in this project?

@Djfox936 Djfox936 reopened this Jan 29, 2022
@G00fY2
Copy link
Owner

G00fY2 commented Jan 31, 2022

You can simply check the result and content type to access the data:

E.g.

fun handleResult(result: QRResult) {
  if (result is QRSuccess) {
    when (val content = result.content) {
      is QRContent.CalendarEvent -> TODO()
      is QRContent.ContactInfo -> TODO()
      is QRContent.Email -> TODO()
      is QRContent.GeoPoint -> TODO()
      is QRContent.Phone -> TODO()
      is QRContent.Plain -> TODO()
      is QRContent.Sms -> TODO()
      is QRContent.Url -> TODO()
      is QRContent.Wifi -> {
        val ssid = content.ssid
      }
    }
  }
}

Feel free to reopen this issue if there is anything missing.

@G00fY2 G00fY2 closed this as completed Jan 31, 2022
@G00fY2 G00fY2 added the question Further information is requested label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants