mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
feat: 完善了获取设备名称 Android 平台的实现
This commit is contained in:
@@ -2,6 +2,7 @@ package com.lifegpc.ehf
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.lifegpc.ehf.annotation.ChannelMethod
|
import com.lifegpc.ehf.annotation.ChannelMethod
|
||||||
import com.lifegpc.ehf.eventbus.SAFAuthEvent
|
import com.lifegpc.ehf.eventbus.SAFAuthEvent
|
||||||
@@ -31,6 +32,11 @@ class MainActivity : FlutterActivity() {
|
|||||||
flutterEngine,
|
flutterEngine,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
MethodChannelUtils.registerMethodChannel(
|
||||||
|
"lifegpc.eh_downloader_flutter/device",
|
||||||
|
flutterEngine,
|
||||||
|
this
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
@@ -59,4 +65,8 @@ class MainActivity : FlutterActivity() {
|
|||||||
private fun disableFlagSecure() {
|
private fun disableFlagSecure() {
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ChannelMethod(methodName = "deviceName")
|
||||||
|
@Suppress("unused")
|
||||||
|
private fun getDeviceName(): String = Build.MODEL
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user