WatchFriends / Android

Mobile phone application build for Android made with Java | build for Cross Platform Applications
0 stars 1 forks source link

Foutmelding indien geen internet #111

Open HeinPauwelyn opened 8 years ago

HeinPauwelyn commented 8 years ago

Foutmelding geven indien geen internet op ELK fragment en check if (result != null) Nu crest app en is niet leuk voor gebruikers.

mickverm commented 7 years ago

Interessante code in voorbeeldoefening van @walcariuss

public class ServiceHelper {

    public static boolean isDeviceOnline(Context context) {
        ConnectivityManager cm =
                (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

        NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
        return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
    }
}