Browse Source

1.添加设置默认输入法的方法

20241218TB223FC(测试jar包)
wangwanlei 4 months ago
parent
commit
e05c46e1d3
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      app/src/main/java/com/xhly/manageapp/ManageApplication.kt

+ 13
- 0
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

7
 import android.content.Context
7
 import android.content.Context
8
 import android.content.pm.PackageManager
8
 import android.content.pm.PackageManager
9
 import android.os.Build
9
 import android.os.Build
10
+import android.util.Log
10
 import androidx.core.content.ContextCompat
11
 import androidx.core.content.ContextCompat
11
 import androidx.multidex.MultiDex
12
 import androidx.multidex.MultiDex
12
 import androidx.multidex.MultiDexApplication
13
 import androidx.multidex.MultiDexApplication
787
             }
788
             }
788
         }
789
         }
789
 
790
 
791
+        //设置默认输入法
792
+        fun setDefaultInputMethod(pkg: String){
793
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()){
794
+                try {
795
+                    var defaultInputMethod = csdkManager?.setDefaultInputMethod(pkg)
796
+                    Log.d("设置输入法","设置结果"+defaultInputMethod)
797
+                }catch (e:Exception){
798
+
799
+                }
800
+            }
801
+        }
802
+
790
     }
803
     }
791
 
804
 
792
     override fun onCreate() {
805
     override fun onCreate() {

Loading…
Cancel
Save