最近感觉android系统自带的 输入法很不好用, 打字的时候老是点击错误, 于是把android系统自带的输入法从系统里直接干掉了(必须破解后),安装了搜狗输入法,感觉用搜狗的输入法输入文字非常快,中英文,标点符号切换都很快.但是如果手机每次重启的时候搜狗输入法启动的很慢,有时候就是启动不起来,所以无法输入文件信息.于是我就写下了下面的程序,开始自动启动搜狗输入法进程:admin管理员组文章数量:1632346
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android/apk/res/android"
package="sunny.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
</application>
[i][b] <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>[/b][/i]
</manifest>
BootBroadcastReceiver.java:
package sunny.app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootBroadcastReceiver extends BroadcastReceiver {
static final String ACTION = "android.intent.action.BOOT_COMPLETED";
int ActionFlag = 0;
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION)) {
Intent helloIntent = new Intent(context,StartSouGou.class);
helloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(helloIntent);
ActionFlag = -1;
}
}
}
StartSouGou.java:
package sunny.app;
import java.io.IOException;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class StartSouGou extends Service {
public IBinder onBind(Intent arg0) {
return null;
}
public int onStartCommand(Intent intent, int flags, int startId) {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("com.sohu.inputmethod.sogou");
} catch (IOException e) {
}
return super.START_NOT_STICKY;
}
public void onDestroy() {
super.onDestroy();
}
}
com.sohu.inputmethod.sogou 为搜狗的进程
版权声明:本文标题:android开机调用搜狗输入法 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1729128286a1187544.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论