version
fix: update:修改包名
This commit is contained in:
57
app/src/main/java/com/xwad/os/jxw/Util.java
Normal file
57
app/src/main/java/com/xwad/os/jxw/Util.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.xwad.os.jxw;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class Util {
|
||||
public static String getDate() {
|
||||
return new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isNetworkAvailable(Context context) {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo[] allNetworkInfo = connectivityManager.getAllNetworkInfo();
|
||||
boolean wifiConnected = false;
|
||||
boolean mobileConnected = false;
|
||||
for (NetworkInfo networkInfo : allNetworkInfo) {
|
||||
String typeName = networkInfo.getTypeName();
|
||||
if (typeName.equalsIgnoreCase("WIFI") && networkInfo.isConnected()) {
|
||||
wifiConnected = true;
|
||||
}
|
||||
if (typeName.equalsIgnoreCase("MOBILE") && networkInfo.isConnected()) {
|
||||
mobileConnected = true;
|
||||
}
|
||||
}
|
||||
return wifiConnected || mobileConnected;
|
||||
}
|
||||
|
||||
public static void insertData(Context context, String str, String str2, long j, String str3, String str4, String str5, String str6) {
|
||||
Log.e("成长计划--埋点", str3);
|
||||
// Uri parse = Uri.parse("content://com.jxw.maidain.StudyDetailsProvider/insert");
|
||||
// ContentValues contentValues = new ContentValues();
|
||||
// contentValues.put("appId", "com.jxw.launcher");
|
||||
// contentValues.put("subjectType", str6);
|
||||
// contentValues.put("eventType", str2);
|
||||
// contentValues.put("metricsValue", Long.valueOf(j));
|
||||
// contentValues.put("recordTime", Long.valueOf(System.currentTimeMillis()));
|
||||
// contentValues.put("deviceType", "pb");
|
||||
// contentValues.put("recordMsg", str5);
|
||||
// contentValues.put("eventId", str);
|
||||
// contentValues.put("subjectName", str3);
|
||||
// contentValues.put("subjectId", str4);
|
||||
// try {
|
||||
// context.getContentResolver().insert(parse, contentValues);
|
||||
// } catch (Exception unused) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user