Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/ConnectivityUtils.java

Issue 29673565: Issue 6066 - Implement 'force update' functionality for subscriptions (Closed)
Patch Set: Fixed typos and line length Created Jan. 19, 2018, 11:01 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.sbrowser.contentblocker.util;
19
20 import android.content.Context;
21 import android.net.ConnectivityManager;
22 import android.net.NetworkInfo;
23
24 public class ConnectivityUtils
25 {
26 public static boolean hasWifiConnection(final Context context)
27 {
28 final ConnectivityManager connManager = (ConnectivityManager) context
29 .getSystemService(Context.CONNECTIVITY_SERVICE);
30 final NetworkInfo current = connManager.getActiveNetworkInfo();
31 return current != null && current.getType() == ConnectivityManager.TYPE_WIFI ;
diegocarloslima 2018/01/19 13:59:00 I think its interesting to also consider Bluetooth
jens 2018/01/19 14:32:55 Acknowledged.
32 }
33
34 public static boolean hasInternetConnection(final Context context)
35 {
36 final ConnectivityManager connManager = (ConnectivityManager) context
37 .getSystemService(Context.CONNECTIVITY_SERVICE);
38 return connManager != null && connManager.getActiveNetworkInfo() != null;
diegocarloslima 2018/01/19 13:59:00 Seems that connManager.getActiveNetworkInfo().isCo
jens 2018/01/19 14:32:55 Acknowledged.
39 }
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld