Содержание
- 2. Networking. Premissions "android.permission.ACCESS_NETWORK_STATE" />
- 3. Networking. Manage Network Connection final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if
- 4. Networking. Connectivity Change 1 Explicit boadcast: final IntentFilter filter = new IntentFilter(); filter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); registerReceiver(new ConnectivityReceiver(), filter);
- 5. Networking. Connectivity Change Job Scheduler: JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); JobInfo job = new JobInfo.Builder(MY_BACKGROUND_JOB, new
- 6. Networking. Data Usage 1 Detect if connection is metered or unmetered 2 Detect if Data Saver
- 7. Networking. Connecting final URL url = new URL("exampleurl.com"); final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setReadTimeout(5000); connection.setConnectTimeout(5000);
- 8. Networking. Read Input Stream if (inputStream != null) { StringBuffer stringBuffer = new StringBuffer(); try {
- 9. Networking. JSON Parsing { "users": [ { "id": "007", "name": "James Bond", "email": "james.bond@MI6.com", "address": "London",
- 10. Networking. JSON Parsing final JSONObject object = new JSONObject(result); final JSONArray jsonArray = object.getJSONArray("users"); if (jsonArray
- 11. Networking. JSON Parsing Google GSON https://github.com/google/gson final Gson gson = new GsonBuilder().create(); final User[] users =
- 12. Networking. UI thread
- 14. Скачать презентацию