android-wifi-connecter

码农软件 · 软件分类 · 手机开发包 · 2019-05-06 19:13:09

软件介绍

这是一个用来连接到 WIFI 热点的库。

简单实用方法:

final Intent intent = new Intent("com.farproc.wifi.connecter.action.CONNECT_OR_EDIT");
intent
.putExtra("com.farproc.wifi.connecter.extra.HOTSPOT", scanResult);
startActivity
(intent);

更完整的例子:

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.widget.Toast;
...
...
private static void launchWifiConnecter(final Activity activity, final ScanResult hotspot) {
 
final Intent intent = new Intent("com.farproc.wifi.connecter.action.CONNECT_OR_EDIT");
  intent
.putExtra("com.farproc.wifi.connecter.extra.HOTSPOT", hotspot);
 
try {
    activity
.startActivity(intent);
 
} catch(ActivityNotFoundException e) {
   
// Wifi Connecter Library is not installed.
   
Toast.makeText(activity, "Wifi Connecter is not installed.", Toast.LENGTH_LONG).show();
    downloadWifiConnecter
(activity);
 
}
}

private static void downloadWifiConnecter(final Activity activity) {
 
Intent downloadIntent = new Intent(Intent.ACTION_VIEW)
   
.setData(Uri.parse("market://details?id=com.farproc.wifi.connecter"));
 
try {
    activity
.startActivity(downloadIntent);
   
Toast.makeText(activity, "Please install this app.", Toast.LENGTH_LONG).show();
 
} catch (ActivityNotFoundException e) {
   
// Market app is not available in this device.
   
// Show download page of this project.
   
try {
      downloadIntent
.setData(Uri.parse("http://code.google.com/p/android-wifi-connecter/downloads/list"));
      activity
.startActivity(downloadIntent);
     
Toast.makeText(activity, "Please download the apk and install it manully.", Toast.LENGTH_LONG).show();
   
} catch  (ActivityNotFoundException e2) {
     
// Even the Browser app is not available!!!!!
     
// Show a error message!
     
Toast.makeText(activity, "Fatel error! No web browser app in your device!!!", Toast.LENGTH_LONG).show();
   
}
 
}
}

本文地址:https://www.codercto.com/soft/d/5169.html

算法设计技巧与分析

算法设计技巧与分析

阿苏外耶 / 电子工业出版社 / 2003-01-01 / 40.0

本书由World Scienti一起来看看 《算法设计技巧与分析》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具