Hi everyone,
today I want to talk about Android Vibration in Unity3D.
As I tested on Kindle, the SystemInfo.supportsVibration returned true even if there's no vibrator on it.
So, I decided to Call the native Android Java Class.
That was my code :
_____________________________________________________________________
AndroidJavaObject activity;
AndroidJavaObject mWindowManager;
bool result;
public void Start()
{
if (mWindowManager == null)
{
using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").
GetStatic<AndroidJavaObject>("currentActivity"))
{
mWindowManager = activity.Call<AndroidJavaObject>("getSystemService","sensor");
}
}
result = mWindowManager.Call<bool>("hasVibrator");
________________________________________________________________________
But all my tries were useless. In fact, as I saw on this link, the function I wanted to call, which is hasVibrator(), can only be used on API 11 ( Android 3.0 ) .
So in all Android Systems from 2.0 to 2.3.3 vibration support can't be checked !!!!!!!
So, if I'll find some different way to check that, it will be written on this blog :)
Cheers,
Nik
Tuesday, October 2, 2012
Introduction
Hi Everyone :)
So,
this is my first post in my Blog! I don't know actually if I need a Blog. However, a friend here, told me I should write somewhere all my experiences in Programming. Yeah, that's why I'm here.
As you probably know, I'm a Game Developer.
So I'll post here all my experiences and difficult issues which I solved during my career :) trying to help you or... showing you how much Programming is cool :)
Cheers,
Nikolai
Subscribe to:
Posts (Atom)