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

  • SEARCH
  • Home
  • 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 6100333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:22:27+00:00 2026-05-23T13:22:27+00:00

I’ve hit an interesting part in my studies with Android. I’m as I go

  • 0

I’ve hit an interesting part in my studies with Android. I’m as I go through I have created a timed PendingIntent to go off. Before it goes off, I lock the phone. When it goes off. I see it runs though and attempts to change the vibrate setting on my phone. Unfortunately it doesn’t apply the setting.

code:

PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "VibrateTag");
wakeLock.acquire();

AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

int ringerMode = audio.getRingerMode();
if(ringerMode != AudioManager.RINGER_MODE_NORMAL && item.getVibrate() && item.getVolume() != 0)
{
    audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
}

final String INFO = "INFO";

int vibrateSetting = AudioManager.VIBRATE_SETTING_OFF;
if (item.getVolume() != 0)
{
    if (item.getVibrate()) vibrateSetting = AudioManager.VIBRATE_SETTING_ON;
}
else
{
    if (item.getVibrate()) vibrateSetting = AudioManager.VIBRATE_SETTING_ONLY_SILENT;
}

Log.e(INFO,"AReceiver attempting to update vibrate to " + vibrateSetting);

audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, vibrateSetting);

Log.e(INFO,"AReceiver updated vibrate to " + audio.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER));

wakeLock.release();

log when locked:

06-27 18:31:00.184: ERROR/INFO(3031): AReceiver attempting to update vibrate to 1
06-27 18:31:00.184: ERROR/INFO(3031): AReceiver updated vibrate to 0

Like I said when unlocked and in use, that log would read showing the change was successful where it would change its value to 1.

Now if I have my phone unlocked and I do this, it works. The Broadcast works (started on BootUp).

I’ve even tried to lock down permissions to use with:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<uses-permission android:name="android.permission.VIBRATE"/>

<uses-permission android:name="android.permission.WAKE_LOCK"/>

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

Now with that in mind, I also tried doing these things with and without the wake lock.

  1. Can settings be changed when in a lock state?

  2. What am I missing for that to occur? I bet it’s just something so simple I’m over looking.

Thanks,
Kelly

  • 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-23T13:22:28+00:00Added an answer on May 23, 2026 at 1:22 pm

    Currently these are the phone states I’m using for this to work. I think the thing that makes it work is the modify phone state. Hopefully, this can help someone else out.

    BTW. It really a pain some of the description in the google docs for this. Does anyone know of a better place that (I know this is a funny question because they’re google’s docs) describes the phone’s user permissions.

    One other thing. After some reading, it has been noted that the modify phone state has changed some with future behavior. Basically some hidden / undocumented classes / Interfaces can be used like in 2.2.

    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
    
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    
    <uses-permission android:name="android.permission.VIBRATE"/>
    
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    
    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.