Your class doesn't have the method getSystemService
since this class dosen't extend a Activity
.
If you wan't to use the getSystemService
method you need your class VibrationManager
to extend an activity or you need to receive a context for that.
Just change your code to use a context, for that you will need to also get a context in your static call.
public class VibrationManager {
private static VibrationManager me;
private Context context;
Vibrator v = null;
private Vibrator getVibrator(){
if(v == null){
v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
}
return v;
}
public static VibrationManager getManager(Context context) {
if(me == null){
me = new VibrationManager();
}
me.setContext(context);
return me;
}
private void setContext(Context context){
this.context = context;
}
public void vibrate(long[] pattern){
}
}