I am developing an App for a smartwatch using Android 6.01 API 23.
I want to add some vibration capabilities.
I have defined in my AndroidManifest.xml
the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myexample.warehousehelper.mobile">
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I am getting the following exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{myexample.warehousehelper/myexample.warehousehelper.wear.MainActivity}:
java.lang.SecurityException: Requires VIBRATE permission
The "vibration call" is as follows:
Vibrator v = (Vibrator) getSystemService(VIBRATOR_SERVICE);
v.vibrate(200);
Any hint why is this behaviour?