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://codercto.com/soft/d/5169.html

Building Web Reputation Systems

Building Web Reputation Systems

Randy Farmer、Bryce Glass / Yahoo Press / 2010 / GBP 31.99

What do Amazon's product reviews, eBay's feedback score system, Slashdot's Karma System, and Xbox Live's Achievements have in common? They're all examples of successful reputation systems that enable ......一起来看看 《Building Web Reputation Systems》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具