-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
27 changed files
with
193 additions
and
142 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
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
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
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
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
30 changes: 0 additions & 30 deletions
30
...n/java/br/edu/uepb/nutes/ocariot/data/repository/remote/NetworkConnectionInterceptor.java
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
app/src/main/java/br/edu/uepb/nutes/ocariot/utils/ConnectionUtils.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,46 @@ | ||
package br.edu.uepb.nutes.ocariot.utils; | ||
|
||
import android.bluetooth.BluetoothAdapter; | ||
import android.content.Context; | ||
import android.net.ConnectivityManager; | ||
import android.net.NetworkInfo; | ||
|
||
/** | ||
* Provides routines for checking connection with internet and bluetooth. | ||
* | ||
* @author Douglas Rafael <[email protected]> | ||
* @version 0.1 | ||
* @copyright Copyright (c) 2017, NUTES/UEPB | ||
*/ | ||
public class ConnectionUtils { | ||
/** | ||
* Checks if the device supports bluetooth. | ||
* | ||
* @return true for device supports bluetooth or false otherwise. | ||
*/ | ||
public static boolean isSupportedBluetooth() { | ||
return BluetoothAdapter.getDefaultAdapter() != null; | ||
} | ||
|
||
/** | ||
* Checks if bluetooth is enabled. | ||
* | ||
* @return true to enabled or false otherwise. | ||
*/ | ||
public static boolean isBluetoothAvailable() { | ||
return BluetoothAdapter.getDefaultAdapter() != null && | ||
BluetoothAdapter.getDefaultAdapter().isEnabled(); | ||
} | ||
|
||
/** | ||
* Checks if the device has an internet connection. | ||
* | ||
* @param context | ||
* @return boolean | ||
*/ | ||
public static boolean isNetworkAvailable(Context context) { | ||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | ||
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); | ||
return (networkInfo != null && networkInfo.isConnectedOrConnecting()); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.