@Aleadam is right, you should publish your details later as soon as your Internet is connected, however you can check your intention to connect using this method.
public boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null; }
but for this method you will need to import some Android libraries these
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo;
Hope this helps.
Adeel pervaiz
source share