4

The method getSystemService(String) is undefined for the type WebAppInterface 「getSystemService」を使用すると、このエラーが発生しました。私は活動クラスではなくインターフェースクラスで働いていました。

 @JavascriptInterface
public void Viber(String value ) {
    if (value.equals("on")) {
        // Get instance of Vibrator from current Context
        Vibrator v = (Vibrator)getSystemService(mContext.VIBRATOR_SERVICE);

        // Vibrate for 300 milliseconds
        v.vibrate(300);
    }

}
4

4 に答える 4

0

mContext.VIBRATOR_SERVICE => Context.VIBRATOR_SERVICE

于 2013-06-24T13:02:27.377 に答える