13 Haziran 2017 Salı

WifiInfo Sınıfı

constructor
Şöyle yaparız.
WifiManager wifiManager = ...;
WifiInfo info = wifiManager.getConnectionInfo ();
getBSSId metodu
Şöyle yaparız.
wifiInfo.getBSSID ();
getDetailedStateOf metodu
Şöyle yaparız.
NetworkInfo.DetailedState state = WifiInfo.
  getDetailedStateOf(wifiInfo.getSupplicantState());
if(state == NetworkInfo.DetailedState.CONNECTED ||
   state == NetworkInfo.DetailedState.OBTAINING_IPADDR) {
  ...
}
getMacAddress metodu
Wifi MAC Adresi şöyle alınır.
String macAddress = wifiInfo.getMacAddress();
getLinkSpeed metodu
Şöyle yaparız.
WifiInfo wifiInfo = ...
Integer linkSpeed = wifiInfo.getLinkSpeed();
getSSId metodu
Şöyle yaparız.
String wifiSSID = wifiInfo.getSSID();



10 Haziran 2017 Cumartesi

Location Sınıfı

Giriş
Şu satırı dahil ederiz.
import android.location.Location;
distanceBetween metodu
İmzası şöyle.
public static void distanceBetween (double startLatitude, double startLongitude, 
  double endLatitude, double endLongitude, float[] results)
results[0] mesafeyi metre olarak verir.
results[1] başlangıç noktasından varış noktasına olan bearing (kerterizi) verir.

Örnek
Şöyle yaparız.
float[] distance = new float[2];

Location.distanceBetween(latitude1, longitude1,
    latitude2, longitude2, distance);
Örnek
Şöyle yaparız. Burada kendi konumum ile bir önceli Location nesnesinin konumu arasındaki mesafe bulunuyor.
double myLatitude = ...; double myLongitude = ...;
Location o = ...
float[] result = new float[3];
Location.distanceBetween(myLatitude, myLongitude, o.Lat, o.Long, result);
Float distance = result[0];
distanceTo metodu
Şöyle yaparız.
Location loc1 = new Location("");
loc1.setLatitude(lat1);
loc1.setLongitude(lon1);

Location loc2 = new Location("");
loc2.setLatitude(lat2);
loc2.setLongitude(lon2);

float distanceInMeters = loc1.distanceTo(loc2);
getLatitude metodu
Şöyle yaparız.
double lat = loc.getLatitude();
getLongitude metodu
Şöyle yaparız.
double lon = loc.getLongitude();

7 Haziran 2017 Çarşamba

MQTT Sınıfı

BlockingConnection Sınıfı
Giriş
Şu satırı dahil ederiz.
import org.fusesource.mqtt.client.BlockingConnection;
Bu sınıfı MQTT nesnesi tarafından yaratılır.
connect metodu
Şöyle yaparız.
connection.connect();
MQTT Sınıfı
Giriş
Şu satırı dahil ederiz.
import org.fusesource.mqtt.client.MQTT;
constructor
Şöyle yaparız.
MQTT mqtt =new MQTT();
blockingConnection metodu
Şöyle yaparız.
BlockingConnection connection = mqtt.blockingConnection();
setHost metodu
Şöyle yaparız.
mqtt.setHost("tcp://10.30.60.242:1883");

2 Haziran 2017 Cuma

Settings.Secure Sınıfı

getInt metodu
Şöyle yaparız.
ContentResolver cr = getContentResolver();

int lockPatternEnable = Settings.Secure.getInt(cr,
  Settings.Secure.LOCK_PATTERN_ENABLED, 0);
// If user has pattern unlock then lockPatternEnable will be 1 else 0

FingerprintManagerCompat Sınıfı

Giriş
Bu sınıfı kullanabilmek için şu izin gerekir.
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
Biometric Donanım
Açıklaması şöyle
Biometrics never leave hardware-backed keystore (TEE). Apps use android Biometric API to authenticate the user. Biometric is verified by hardware-backed keystore which answers authentication result with success or failure to the API.
Açıklaması şöyle
Secrets that are bound to in-app biometric authentication are encrypted by the key that is generated & stored in TEE. Apps can also import cryptographic keys in TEE. Unless biometric authentication succeeds which is verified by TEE, TEE doesn't release keys of the querying app. This protection ensures that even if a malicious app compromises other apps, it won't be able to steal secrets of those apps without user authentication.
TEE kullanan File Based Encryption (FBE) Açıklaması şöyle
Açıklaması şöyle
All android 7+ devices are enrolled with File Based Encryption (FBE) that encrypts /data partition from first boot. FBE keys are bound to TEE and user screen lock authentication. On factory reset, TEE clears stored keys and OS wipes the data. At this point, even if your screen lock password is known, it's not possible to decrypt recovered data.
from metodu
Şöyle yaparız.
FingerprintManagerCompat fp = FingerprintManagerCompat.from(context);
isHadwareDetected metodu
Şöyle yaparız.
if (fp.isHardwareDetected() && fp.hasEnrolledFingerprints()) { 
  // Device supports fingerprint authentication and has registered a fingerprint
}