Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1089189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:11:02+00:00 2026-05-16T23:11:02+00:00

I’m making a vibrate toggling widget (in fact, its first version is already in

  • 0

I’m making a vibrate toggling widget (in fact, its first version is already in the Market) but I’m having some problems with the vibrate settings of Android 2.2.

Up to Android 2.1 I have no problem, when I want to disable vibrate I do

am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,AudioManager.VIBRATE_SETTING_OFF);
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,AudioManager.VIBRATE_SETTING_OFF);

and the same but with VIBRATE_SETTING_ON on both lines to turn it on, and it works allright.

However, since Android 2.2 introduced “Vibrate only in silent mode” and “Vibrate when not in silent mode”, I don’t know how to make it work. When vibrate is set to “Always” or “Never” there’s no problem, but as soon as the user manually sets it to one of the other two settings, the app starts doing strange things.

For example, if I have it set to “vibrate only in silent mode” and I turn vibration off via my widget, it turns off, but when I turn it back on… it goes back to “only in silent mode” instead of “Always”. In fact, there’s no way to set it back to “Always” unless you do it via Settings -> Sound, so I guess the combobox for vibrate mode is doing something else that I don’t know of. It’s like it stored the value somewhere else, because even if I set manually to “Always”, when I disable it and enable it again via the widget (with the code I posted before) it keeps going back to “Vibrate only in silent mode”.

And what’s more, there’s a value in AudioManager class for “Only in silent mode” (VIBRATE_SETTING_ONLY_SILENT) but when you set it to “Only when not in silent mode” it uses VIBRATE_SETTING_ON, so there are no way to detect it (not that I know of, I mean).

Hope I have not been too confusing, but I wanted to give all the possible data. And with all that set…

Does anyone know how to properly handle vibrate settings in 2.2? Is there any other variable that I have to set or function that I have to call in order to disable or enable vibrate completely? Or a way to “reset” the phone to a known state so that it works ok?

The steps to reproduce the problem (or, at least, one of the problems) are:

  • Set vibrate to “only in silent mode” via the settings menu.

  • Set vibrate to “never” via the widget:

    setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);

  • Check in the settings menu that vibrate is set to “never”.

  • Set vibrate to “always” via the widget:

    setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);

  • Go to the settings menu -> Vibrate is set to “Only in silent mode”
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:11:02+00:00Added an answer on May 16, 2026 at 11:11 pm

    Ok, I think I finally fixed it.
    I looked at the source code of the com.android.settings.Settings class and copied part of the methods that enable and disable vibrate:
    https://android.googlesource.com/platform/packages/apps/Settings/+/master/src/com/android/settings/SoundSettings.java

    Thank you anyway magaio, you pointed me in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.