Commit fb6032f2 authored by jyx's avatar jyx

添加运营商信息上送

parent ec5c3105
......@@ -6,12 +6,7 @@ import android.content.Context
import android.content.Intent
import cn.jpush.android.api.BasicPushNotificationBuilder
import cn.jpush.android.api.JPushInterface
import com.fly.scenemodule.SceneUtil
import com.fly.scenemodule.model.GDTInfo
import com.fly.scenemodule.model.TTInfo
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.BxmManager.initBxm
import com.mints.goodmoney.manager.SceneManager
import com.mints.library.utils.CommonUtils
import com.mob.MobSDK
import com.orhanobut.logger.AndroidLogAdapter
......@@ -22,7 +17,6 @@ import com.tendcloud.tenddata.TCAgent
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
/**
* 子线程初始化SDK
*/
......
......@@ -10,13 +10,15 @@ import android.net.Proxy
import android.net.wifi.WifiInfo
import android.net.wifi.WifiManager
import android.os.Build
import android.os.SystemClock
import android.provider.Settings
import android.telephony.TelephonyManager
import android.text.TextUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.utils.SimUtils
import com.mints.goodmoney.utils.StorageQueryUtil
import com.mints.goodmoney.utils.SystemUtils
import com.mints.library.utils.json.JsonUtil
import java.io.*
import java.net.NetworkInterface
......@@ -42,6 +44,89 @@ class DeviceInfo private constructor() {
return proxyUrl
}
/**
* android4.2以上
* 系统从启动到现在的时间
* 单位:ms
*
*/
val elapsedRealtime = SystemClock.elapsedRealtime()
/**
*
*/
val newModel: String
get() {
return brand + " " + mobileModel +
" " + totalMemory + "+" + totalStorage +
" " + operator
}
/**
* 运营商名称
*
*/
val operator: String
get() {
val sb = StringBuilder("")
try {
var needSingleSim = false
// 卡1
val simStateBySlotIdx1 = SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 0)
// 卡2
val simStateBySlotIdx2 = SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 1)
if (simStateBySlotIdx1) {
val providersName1 = SimUtils.getSimOperatorName2(MintsApplication.getContext(), 0)
if (TextUtils.equals(providersName1, "unknown")) {
needSingleSim = true
sb.append(SimUtils.getSimOperatorNameBySingle(MintsApplication.getContext()) + " ")
} else {
sb.append("$providersName1 ")
}
} else {
sb.append("未插卡 ")
}
if (simStateBySlotIdx2) {
val providersName2 = SimUtils.getSimOperatorName2(MintsApplication.getContext(), 1)
if (TextUtils.equals(providersName2, "unknown") && !needSingleSim) {
sb.append(SimUtils.getSimOperatorNameBySingle(MintsApplication.getContext()) + " ")
} else {
sb.append("$providersName2 ")
}
} else {
sb.append("未插卡 ")
}
} catch (e: Exception) {
}
return sb.toString()
}
/**
* 手机内存大小
*
*/
val totalMemory: String
get() {
return SystemUtils.getTotalMemory()
}
/**
* 手机存储大小
*
*/
val totalStorage: String
get() {
return StorageQueryUtil.getTotalStorageSize(MintsApplication.getContext())
}
/**
* get device's IMSI
*
......
......@@ -9,7 +9,6 @@ import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.manager.ShumeiManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.UserBean;
import com.mints.goodmoney.mvp.model.UserTaskMsgBean;
import com.mints.goodmoney.mvp.views.AwardView;
import com.mints.goodmoney.utils.DeviceUuidFactory;
import com.mints.goodmoney.utils.rxutil.CommonRxTask;
......@@ -49,7 +48,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
switch (code) {
case 200://成功
JsonObject data = baseResponse.getData();
if(data!=null){
if (data != null) {
view.getUserTaskMsgSuc(data.get("coin").getAsInt());
}
break;
......@@ -82,7 +81,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("model", deviceInfo.getNewModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
......
......@@ -69,7 +69,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
/**
* 修改用户信息
*/
public void editUserMsg(String wxOpenid,String wxInfo) {
public void editUserMsg(String wxOpenid, String wxInfo) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("type", "OPENID");
vo.put("value", wxInfo);
......@@ -107,7 +107,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
view.editUserMsgSuc();
}
break;
case 612 :
case 612:
view.mergeAccount(UserManager.getInstance().getMobile(), wxOpenid, baseResponse.getData().getToKeepAnAccount());
break;
default:
......@@ -144,7 +144,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("model", deviceInfo.getNewModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
......
......@@ -34,7 +34,7 @@ class HomePresenter : BasePresenter<HomeView>() {
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = MintsApplication.OAID
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......@@ -167,7 +167,7 @@ class HomePresenter : BasePresenter<HomeView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
......@@ -247,7 +247,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......@@ -280,6 +280,5 @@ class LoginPresenter : BasePresenter<LoginView>() {
})
}
}
\ No newline at end of file
......@@ -193,7 +193,7 @@ class MyPresenter : BasePresenter<MyView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
......@@ -67,7 +67,7 @@ class PanPresenter : BasePresenter<PanView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
......@@ -2,14 +2,15 @@ package com.mints.goodmoney.ui.activitys
import android.content.Context
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.bytedance.hume.readapk.HumeSDK
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
......@@ -19,9 +20,9 @@ import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.*
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.SimUtils
import kotlinx.android.synthetic.main.activity_main.*
/**
* 描述:main
* 作者:孟崔广
......
......@@ -42,8 +42,6 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
override fun initViewsAndEvents() {
settingsPresenter.attachView(this)
SceneUtil.signIn(this, SceneManager.SCENE_CHANNEL_Id, userManager.userID, MintsApplication.OAID)
initLayout()
}
......
......@@ -7,7 +7,6 @@ import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.MyZhangyueFragment
import com.mints.goodmoney.ui.fragment.RsNewsFragment
import com.mints.goodmoney.ui.fragment.ZhangyueFragment
import kotlinx.android.synthetic.main.header_layout.*
/**
......
......@@ -839,7 +839,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
// 聚乐云
// 聚乐云初始化
SceneManager.initScene()
// 同步账户
SceneUtil.signIn(requireActivity(), SceneManager.SCENE_CHANNEL_Id, userManager.userID, MintsApplication.OAID)
......@@ -881,7 +881,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
// vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
......
package com.mints.goodmoney.utils
import android.app.ActivityManager
import android.app.usage.StorageStatsManager
import android.content.Context
import android.os.Build
import android.os.Environment
import android.os.StatFs
import android.os.storage.StorageManager
import androidx.core.content.ContextCompat.getSystemService
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
import java.io.IOException
import java.lang.reflect.Field
import java.lang.reflect.Method
import java.util.*
import kotlin.math.ceil
object SystemUtils {
......@@ -21,8 +36,8 @@ object SystemUtils {
fun getProcessName(cxt: Context, pid: Int): String? {
val am: ActivityManager = cxt.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningApps: List<ActivityManager.RunningAppProcessInfo> =
am.runningAppProcesses
?: return null
am.runningAppProcesses
?: return null
for (procInfo in runningApps) {
if (procInfo.pid == pid) {
return procInfo.processName
......@@ -30,4 +45,47 @@ object SystemUtils {
}
return null
}
/**
* ram
*/
fun getTotalMemory(): String {
// 系统内存信息文件
val file = "/proc/meminfo"
val memInfo: String
val strs: Array<String>
var memory: Long = 0
try {
val fileReader = FileReader(file)
val bufferedReader = BufferedReader(
fileReader,
8192
)
// 读取meminfo第一行,系统内存大小
memInfo = bufferedReader.readLine()
strs = memInfo.split("\\s+".toRegex()).toTypedArray()
// 获得系统总内存,单位KB
memory = Integer.valueOf(strs[1]).toLong()
bufferedReader.close()
} catch (e: Exception) {
e.printStackTrace()
}
return "" + ceil((memory.toFloat() / (1024 * 1024).toDouble())).toInt() + "GB"
}
/**
* 获取手机内部空间总大小
*
* @return 大小,字节为单位
*/
fun getTotalInternalMemorySize(): String {
//获取内部存储根目录
val path: File = Environment.getExternalStorageDirectory()
//系统的空间描述类
val stat = StatFs(path.absolutePath)
//每个区块占字节数
val totalSize = stat.totalBytes
return "" + ceil((totalSize.toFloat() / (1024 * 1024 * 1024).toDouble())).toInt() + "GB"
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment