mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Remove toast for internet connection change. Fixes #206
This commit is contained in:
parent
a380dd942c
commit
0c76228222
2 changed files with 0 additions and 42 deletions
|
|
@ -61,12 +61,6 @@
|
|||
android:resource="@xml/widget_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver android:name="com.habitrpg.android.habitica.receivers.NetworkChangeReceiver" >
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service android:name=".widget.UpdateWidgetService" />
|
||||
|
||||
<meta-data
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
package com.habitrpg.android.habitica.receivers;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by franzejr on 03/11/15.
|
||||
*/
|
||||
public class NetworkChangeReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
if (hasInternetConnection(context)) {
|
||||
Toast.makeText(context, R.string.network_up, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(context, R.string.network_error_no_network_body, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasInternetConnection(Context context) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
||||
|
||||
if (networkInfo != null && networkInfo.isConnected()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue