Android Open Source - GarageRadio Network Manager






From Project

Back to project page GarageRadio.

License

The source code is released under:

Apache License

If you think the Android project GarageRadio listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.saracraba.garageradio;
//from   w ww . j  a  v  a2 s .c om
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Sara Craba
 */
public class NetworkManager {
    private final ConnectivityManager connectivityManager;
    protected final static String ERROR_MESSAGE= "Connessione di rete non disponibile\n    abilita il wifi o i dati e riprova";

    private NetworkInfo networkInfo;

    /**
     * Initialize the network manager with the CONNECTIVITY_SERVICE
     *
     * @param context application context where to get the connectivity service. Throw a NullPointerException
     *                if context is null.
     *
     */
    protected NetworkManager(Context context)
    {
        if(context== null)
        {
            throw new NullPointerException();
        }
        this.connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

    }

    /**
     * Checks for internet connection
     *
     * @return  true if a internet connection is available false otherwise
     */
    public boolean getStatus()
    {
        networkInfo= connectivityManager.getActiveNetworkInfo();

        // Check if there is internet connection
        if (networkInfo != null && networkInfo.isConnected())
        {
            return true;
        }

        return false;
    }

}




Java Source Code List

com.garageradio.app.mainpage.AsyncResponse.java
com.garageradio.app.mainpage.DownloadTitle.java
com.garageradio.app.mainpage.MainActivity.java
com.garageradio.app.palimpsest.DownloadPalimpsest.java
com.garageradio.app.palimpsest.PalimpsestActivity.java
com.garageradio.app.palimpsest.PalimpsestRow.java
com.saracraba.garageradio.ApplicationTest.java
com.saracraba.garageradio.DownloadTitle.java
com.saracraba.garageradio.FirstPageActivity.java
com.saracraba.garageradio.MainActivity.java
com.saracraba.garageradio.MediaPlayerManager.java
com.saracraba.garageradio.NetworkManager.java
com.saracraba.garageradio.NotificationManager.java