14

In the iPhone 2.x firmware, can you make the iPhone vibrate for durations other than the system-defined:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

In jailbroken phones, you used to be able to use the MeCCA.framework to do this:

http://pastie.org/94481

MeCCA_Vibrator *v = new MeCCA_Vibrator;
v->activate(1);
sleep(5);
v->deactivate();

But MeCCA.framework doesn't exist on my 2.x iPhone.

4

4 に答える 4

13

はい、これは過去にAppStoreの拒否を引き起こしたものであり、おそらく再びそうなるでしょう...つまり、それはまだ可能です。

私自身の質問に答えて、これを行う方法は次のとおりです。

ビルドフェーズでフレームワークCoreTelephonyを追加します。

宣言する:

extern void * _CTServerConnectionCreate(CFAllocatorRef, int (*)(void *, CFStringRef, CFDictionaryRef, void *), int *);
extern int _CTServerConnectionSetVibratorState(int *, void *, int, int, float, float, float);

static void* connection = nil;
static int x = 0;

初期化:

connection = _CTServerConnectionCreate(kCFAllocatorDefault, &vibratecallback, &x);

バイブレーションを開始します。

_CTServerConnectionSetVibratorState(&x, connection, 3, intensity, 0, 0, 0);

バイブレーションを停止します。

_CTServerConnectionSetVibratorState(&x, connection, 0, 0, 0, 0, 0);

このコードは、HapticKeyboardからのものです。これは、入力時に電話をブーンという音を立てるダウンロード可能なアプリケーションです。Cydiaのジェイルブレイクされた電話で利用できます。私の脱獄経験も参照してください)

他の良い参考文献はありますか?

于 2008-11-11T17:45:26.450 に答える
4

SDK を使用してこれを行う方法はありません。申し訳ありません。

于 2008-11-05T22:35:51.157 に答える
4

SDK を使用してこれを行うことは不可能であるだけでなく、非公式の App Store 拒否基準の最初の項目でもあります。

于 2008-11-05T22:44:29.767 に答える
0

iOS 5 では、カスタム バイブレーション モードが実装されています。そのため、可変振動が許容される場合もあります。唯一のことは、どのライブラリがそれを処理するか (CoreTelephony ではないことは確かです) と、それが開発者に公開されているかどうかは不明です。

于 2012-01-20T04:06:31.427 に答える