Using ACTION_CAPTIVE_PORTAL_SIGN_IN

前端 未结 1 1930
太阳男子
太阳男子 2021-02-06 10:04

The Android M supports a new ACTION_CAPTIVE_PORTAL_SIGN_IN. Is there any sample available on how to capture this action. I tried with the normal way of registering for an action

1条回答
  •  后悔当初
    2021-02-06 10:52

    It can be used to allow your app to perform captive portal Wi-Fi sign in. Assuming you have something like this in your manifest:

    
        
            
            
        
    
    

    Here is what can happen:

    1. Device connects to captive Wi-Fi portal
    2. System displays a captive portal notification
    3. User touches the notification
    4. System displays the implicit intent app chooser
    5. User selects SignInActivity
    6. SignInActivity is launched

    You may access the extras mentioned in the ConnectionManager.ACTION_CAPTIVE_PORTAL_SIGN_IN using getIntent() and getParcelableExtra(). Use the ConnectivityManager.EXTRA_NETWORK extra (which has type Network) to communicate with the portal (i.e. pass sign in tokens), and the ConnectivityManager.EXTRA_CAPTIVE_PORTAL extra (which has type CaptivePortal) to communicate with the system about the outcome of the sign in.

    0 讨论(0)
提交回复
热议问题