如果手机连接到开放式网络(路由器),系统会显示浏览器登录的通知。
同样,当设备连接到wifi(Android wifi热点)时,是否可以显示使用自定义文本打开浏览器的自定义文本的通知?
注意:
连接到wifi的设备没有我的应用程序。通知需要由托管wifi热点的Android设备发送
答案 0 :(得分:1)
现在,您可以创建广泛的侦听器网络更改并调用一个intent Check INTENT internet connection
答案 1 :(得分:1)
1)您可以使用BroadcastReciever“android.net.wifi.WIFI_HOTSPOT_CLIENTS_CHANGED”来检测客户端连接。
在AndroidManifest中:
<receiver
android:name=".WiFiConnectionReciever"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.net.wifi.WIFI_HOTSPOT_CLIENTS_CHANGED" />
</intent-filter>
</receiver>
在活动中:
IntentFilter mIntentFilter = new IntentFilter();
mIntentFilter.addAction("android.net.wifi.WIFI_HOTSPOT_CLIENTS_CHANGED");
rcv = new WiFiConnectionReciever();
registerReceiver(rcv,mIntentFilter);
2)您还可以将连接设备列表发送到HOTSPOT
public void getConnectedClientList() {
int clientcount = 0;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("/proc/net/arp"));
String line;
while ((line = br.readLine()) != null) {
String[] splitted = line.split(" +");
String mac = splitted[3];
System.out.println("Mac : Outside If "+ mac );
if (mac.matches("..:..:..:..:..:..")) {
clientcount++;
System.out.println("Mac : "+ mac + " IP Address : "+splitted[0] );
System.out.println("Client_count " + clientcount + " MAC_ADDRESS "+ mac);
Toast.makeText(
getApplicationContext(),
"Client_count " + clientcount + " MAC_ADDRESS "
+ mac, Toast.LENGTH_SHORT).show();
}
}
} catch(Exception e) {
}
}