質問

I am developing an custom keyboard/Input method service as given bellow

http://android-developers.blogspot.in/2009/04/creating-input-method.html

In this I want to know which client application is using my keyboard? Like user is typing a message with my keyboard or writing an email or any other app like whatsapp..

Is there any way? Please help

役に立ちましたか?

解決

I got it using this code

ActivityManager am = (ActivityManager) mContext
                .getSystemService(Activity.ACTIVITY_SERVICE);
        String packageName = am.getRunningTasks(1).get(0).topActivity
                .getPackageName();
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top