mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-09 10:30:37 +08:00
[Android] add VoiceAssistant app example (#834)
* [Android]add VoiceAssistant. * Create VoiceAssistantDemo * Update and rename VoiceAssistantDemo to VoiceAssistantDemo.md * Update VoiceAssistantDemo.md * Delete VoiceAssistantDemo.md * [Android]1.delete about core folder. 2.build and configure bdasr_V3_20210628_cfe8c44.aar file. * change app/build.gradle etc. * Update build.gradle Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.baidu.paddle.fastdeploy.ui">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
@@ -6,6 +6,8 @@ import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.hardware.Camera;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.opengl.GLES20;
|
||||
import android.os.Environment;
|
||||
@@ -310,4 +312,28 @@ public class Utils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isNetworkAvailable(final Context context) {
|
||||
boolean hasWifoCon = false;
|
||||
boolean hasMobileCon = false;
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo[] netInfos = cm.getAllNetworkInfo();
|
||||
for (NetworkInfo net : netInfos) {
|
||||
|
||||
String type = net.getTypeName();
|
||||
if (type.equalsIgnoreCase("WIFI")) {
|
||||
if (net.isConnected()) {
|
||||
hasWifoCon = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (type.equalsIgnoreCase("MOBILE")) {
|
||||
if (net.isConnected()) {
|
||||
hasMobileCon = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasWifoCon || hasMobileCon;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user