<\/span><\/a><\/p>\n\u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441 — \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f, \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u0447\u0435\u0437\u0430\u0435\u0442. \u0412 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438 \u0441\u043c\u0435\u043d\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 configChanges \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n
android:configChanges=\"keyboardHidden|orientation|screenSize\"<\/pre>\n\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f, \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n
\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 MainActivity:<\/p>\n
package ...\r\n\r\nimport android.app.Activity;\r\nimport android.content.Context;\r\nimport android.net.wifi.ScanResult;\r\nimport android.net.wifi.WifiManager;\r\nimport android.os.Bundle;\r\nimport android.support.design.widget.FloatingActionButton;\r\nimport android.support.design.widget.Snackbar;\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.support.v7.widget.Toolbar;\r\nimport android.util.Log;\r\nimport android.view.LayoutInflater;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.ArrayAdapter;\r\nimport android.widget.ListView;\r\nimport android.widget.TextView;\r\n\r\nimport java.util.List;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\n private Element [] nets;\r\n private WifiManager wifiManager;\r\n private List<ScanResult> wifiList;\r\n\r\n\r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_main);\r\n Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);\r\n setSupportActionBar(toolbar);\r\n\r\n FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);\r\n\r\n fab.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View view) {\r\n\r\n detectWifi();\r\n Snackbar.make(view, \"\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435...\", Snackbar.LENGTH_SHORT)\r\n .setAction(\"Action\", null).show();\r\n }\r\n });\r\n\r\n }\r\n\r\n public void detectWifi(){\r\n this.wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);\r\n this.wifiManager.startScan();\r\n this.wifiList = this.wifiManager.getScanResults();\r\n\r\n Log.d(\"TAG\", wifiList.toString());\r\n\r\n this.nets = new Element[wifiList.size()];\r\n\r\n for (int i = 0; i<wifiList.size(); i++){\r\n String item = wifiList.get(i).toString();\r\n String[] vector_item = item.split(\",\");\r\n String item_essid = vector_item[0];\r\n String item_capabilities = vector_item[2];\r\n String item_level = vector_item[3];\r\n String ssid = item_essid.split(\": \")[1];\r\n String security = item_capabilities.split(\": \")[1];\r\n String level = item_level.split(\":\")[1];\r\n nets[i] = new Element(ssid, security, level);\r\n }\r\n\r\n AdapterElements adapterElements = new AdapterElements(this);\r\n ListView netList = (ListView) findViewById(R.id.listItem);\r\n netList.setAdapter(adapterElements);\r\n }\r\n\r\n @Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\r\n \/\/ Inflate the menu; this adds items to the action bar if it is present.\r\n getMenuInflater().inflate(R.menu.menu_main, menu);\r\n return true;\r\n }\r\n\r\n @Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n \/\/ Handle action bar item clicks here. The action bar will\r\n \/\/ automatically handle clicks on the Home\/Up button, so long\r\n \/\/ as you specify a parent activity in AndroidManifest.xml.\r\n int id = item.getItemId();\r\n\r\n \/\/noinspection SimplifiableIfStatement\r\n if (id == R.id.action_settings) {\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }\r\n\r\n class AdapterElements extends ArrayAdapter<Object> {\r\n Activity context;\r\n\r\n public AdapterElements(Activity context) {\r\n super(context, R.layout.items, nets);\r\n this.context = context;\r\n }\r\n\r\n public View getView(int position, View convertView, ViewGroup parent){\r\n LayoutInflater inflater = context.getLayoutInflater();\r\n View item = inflater.inflate(R.layout.items, null);\r\n\r\n TextView tvSsid = (TextView) item.findViewById(R.id.tvSSID);\r\n tvSsid.setText(nets[position].getTitle());\r\n\r\n TextView tvSecurity = (TextView)item.findViewById(R.id.tvSecurity);\r\n tvSecurity.setText(nets[position].getSecurity());\r\n\r\n TextView tvLevel = (TextView)item.findViewById(R.id.tvLevel);\r\n String level = nets[position].getLevel();\r\n\r\n try{\r\n int i = Integer.parseInt(level);\r\n if (i>-50){\r\n tvLevel.setText(\"\u0412\u044b\u0441\u043e\u043a\u0438\u0439\");\r\n } else if (i<=-50 && i>-80){\r\n tvLevel.setText(\"\u0421\u0440\u0435\u0434\u043d\u0438\u0439\");\r\n } else if (i<=-80){\r\n tvLevel.setText(\"\u041d\u0438\u0437\u043a\u0438\u0439\");\r\n }\r\n } catch (NumberFormatException e){\r\n Log.d(\"TAG\", \"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0441\u0442\u0440\u043e\u043a\u0438\");\r\n }\r\n return item;\r\n }\r\n }\r\n}\r\n<\/pre>\n\u0424\u0430\u0439\u043b \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u044f app:<\/p>\n
apply plugin: 'com.android.application'\r\n\r\nandroid {\r\n compileSdkVersion 24\r\n buildToolsVersion \"24.0.2\"\r\n\r\n defaultConfig {\r\n applicationId \"info.fandroid.wifiscanner\"\r\n minSdkVersion 14\r\n targetSdkVersion 24\r\n versionCode 1\r\n versionName \"1.0\"\r\n }\r\n buildTypes {\r\n release {\r\n minifyEnabled false\r\n proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\r\n }\r\n }\r\n}\r\n\r\ndependencies {\r\n compile fileTree(dir: 'libs', include: ['*.jar'])\r\n testCompile 'junit:junit:4.12'\r\n compile 'com.android.support:appcompat-v7:24.2.1'\r\n compile 'com.android.support:design:24.2.1'\r\n}<\/pre>\n\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u0434\u043e Android 6.0. \u0412 6-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043f\u043e\u0445\u043e\u0434 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 — \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0439 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 Android 6.0 \u0438 \u0432\u044b\u0448\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438. \u042d\u0442\u0438\u043c \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u043e\u0432, \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435 <\/a>\u0438 \u0441\u0430\u0439\u0442\u0435 fandroid.info<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u0440\u0443\u0431\u0440\u0438\u043a\u0435 «\u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c android application» \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a Wi-Fi \u0442\u043e\u0447\u0435\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0438\u043c\u0435\u043d\u0438 \u0441\u0435\u0442\u0438, \u0442\u0438\u043f\u0430 \u0437\u0430\u0449\u0438\u0442\u044b \u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0410\u043d\u0434\u0440\u043e\u0438\u0434 \u0421\u0442\u0443\u0434\u0438\u043e. \u0412\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430.\u00a0\u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Basic Activity. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e […]<\/p>\n","protected":false},"author":1,"featured_media":5274,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[224,2],"tags":[3,63,19,14,25,136,140,132,133],"_links":{"self":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5268"}],"collection":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/comments?post=5268"}],"version-history":[{"count":6,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5268\/revisions"}],"predecessor-version":[{"id":5357,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5268\/revisions\/5357"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media\/5274"}],"wp:attachment":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media?parent=5268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/categories?post=5268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/tags?post=5268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}