我想设置一个活动,可以选择它来导航强制门户。
当我选择一个专属的WiFi网络时,我希望能够选择我的应用程序作为处理器,而不是启动每个安卓手机上都预装的CaptivePortalLogin应用程序。
这在Pixel2和OnePlus 6t上都能用,但在我身边的三星手机(S10 (9.0.0),S8 (8.0.0),A6 (8.0.0))上都不行。在三星手机上,它会立即打开CaptivePortalLogin应用程序。
CaptivePortalLogin应用程序没有设置为三星手机上的默认应用程序。
我已经以标准的方式设置了活动:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CAPTIVE_PORTAL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>有没有办法让三星手机和其他手机一样呢?
发布于 2019-06-14 15:06:14
三星使用android强制门户机制,将门户重定向到他们的系统,在内部处理它,并阻止其他强制门户请求和在自己的浏览器上显示。像三星一样,华为等其他供应商也使用自己的机制,只有Oneplus、小米、Htc和其他供应商使用默认机制,因此可以使用门户意图过滤器重定向到应用程序,但不能用于其他应用程序。
<intent-filter>
<action android:name="android.net.conn.CAPTIVE_PORTAL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>这里有一个链接可以清楚地解释它:
https://stackoverflow.com/questions/55341754
复制相似问题