This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2af08b0
commit 437d0f6
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/org/apache/fineract/utils/NetworkChangeReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.apache.fineract.utils; | ||
|
||
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 org.apache.fineract.R; | ||
|
||
|
||
public class NetworkChangeReceiver extends BroadcastReceiver { | ||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
final ConnectivityManager connectivityManager = (ConnectivityManager) context | ||
.getSystemService(Context.CONNECTIVITY_SERVICE); | ||
final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); | ||
if (activeNetworkInfo == null) | ||
Toast.makeText(context, context.getString(R.string.toast_internet_offline), | ||
Toast.LENGTH_LONG).show(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters