2017-06-23 15 views

答えて

1

確認したいと仮定すると、 Javaのを経由してインターネットの存在が、この方法は役立つはず:

public boolean isOnline(Context context) { 
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 
    NetworkInfo netInfo = cm.getActiveNetworkInfo(); 
    //should check null because in airplane mode it will be null 
    return (netInfo != null && netInfo.isConnected()); 
} 

あなたがエミュレータについて話している場合は、単にそれから、ブートアップまで待つブラウザアプリケーションを開き、www.google.comのようなURLを入力してください。それは決定的なテストです。

関連する問題