diff --git a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java index 3c28d7a6cb..18a276f6e5 100644 --- a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java +++ b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.net.Uri; import android.os.Build; @@ -16,6 +17,7 @@ import android.view.KeyEvent; import android.view.View; import android.webkit.MimeTypeMap; +import android.Manifest; import org.haxe.extension.Extension; import org.libsdl.app.SDLActivity; @@ -110,7 +112,13 @@ protected void onCreate (Bundle state) { super.onCreate (state); assetManager = getAssets (); - vibrator = (Vibrator)mSingleton.getSystemService (Context.VIBRATOR_SERVICE); + + if (checkSelfPermission(Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED) { + + vibrator = (Vibrator)mSingleton.getSystemService (Context.VIBRATOR_SERVICE); + + } + handler = new Handler (); Extension.assetManager = assetManager;