The program functions like this: the user has a list of phone numbers, for which the cellphone could vibrate upon an incoming call only when no other system-wide application would provide vibration (such as in mute mode). I know that this is somehow against the rules, for that an application should respect the users' settings, but the application is limited to some certain users with this need. I have tried two ways but neither of them are satisfying:
- Listen to the telephony state and directly trigger the vibration service with my own pattern (with - Vibrator.vibrate()). This method is effective with no incoming calls yet randomly effective when the phone is in- CALL_STATE_RINGINGstate and I guess it's because of the conflict with the system-wide application that actually handles the vibration upon incoming call.
- Judge whether the cellphone is vibrating upon an incoming call (with - AudioManager.shouldVibrate()), and decide whether to change the vibrate settings (with- AudioManager.setRingerMode()and- AudioManager.setVibrateSetting()). If the vibrate settings are changed by my application, they are to be restored once the cellphone is back to- CALL_STATE_IDLEstate. This method, however, is still not functioning sometimes, without any sign of the reason.
I hope that someone could give some advice on this issue. Comments on these two ways or other suggest are welcome.
 
     
    