Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
eDrive
Commits
fa2349ea
Commit
fa2349ea
authored
Oct 08, 2021
by
narinder Rana
Browse files
refine code
parent
be619999
Pipeline
#139789
passed with stage
in 3 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/drive/receivers/ConnectivityReceiver.java
View file @
fa2349ea
...
...
@@ -26,14 +26,6 @@ public class ConnectivityReceiver
}
public
static
boolean
isConnected
()
{
// ConnectivityManager
// cm = (ConnectivityManager) MyApplication.getInstance().getApplicationContext()
// .getSystemService(Context.CONNECTIVITY_SERVICE);
// NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
//
// return activeNetwork != null
// && activeNetwork.isConnectedOrConnecting();
try
{
String
command
=
"ping -c 1 ecloud.global"
;
return
Runtime
.
getRuntime
().
exec
(
command
).
waitFor
()
==
0
;
...
...
@@ -43,17 +35,6 @@ public class ConnectivityReceiver
return
false
;
}
public
boolean
isConecctedToInternet
()
{
Runtime
runtime
=
Runtime
.
getRuntime
();
try
{
Process
ipProcess
=
runtime
.
exec
(
"/system/bin/ping -c 1 8.8.8.8"
);
int
exitValue
=
ipProcess
.
waitFor
();
return
(
exitValue
==
0
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
return
false
;
}
@Override
...
...
@@ -70,7 +51,7 @@ public class ConnectivityReceiver
isConnected
=
activeNetwork
!=
null
&&
activeNetwork
.
isConnectedOrConnecting
();
Log
.
e
(
TAG
,
"connectivityReceiverListener...
isConnected
."
+
isConnected
());
Log
.
e
(
TAG
,
"connectivityReceiverListener...."
+
isConnected
());
if
(
connectivityReceiverListener
!=
null
)
{
connectivityReceiverListener
.
onNetworkConnectionChanged
(
isConnected
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment