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);
}
}