public class MyBroadcastReceiver extends BroadcastReceiver{
public void onReceive(Context context , Intent intent){
Toast.makeText(context, "Your time is up", Toast.LENGTH_LONG).show();
Vibrator vibrator;
// ERROR here (vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(2000);
}
}
ブロードキャストレシーバーを使用してアラームを使用しているときにデバイスを振動させているときに、上記のようなエラーが発生します。ここでエラーが発生する可能性のある理由は何ですか?