Welcome to PhoneASK, where you can ask questions and receive answers from other members of the community.

Set Silent Mode programmaticly in Android by Phonegap

asked 8 days ago by Andreas Krey

how to set the phone(Android OS) programmaticly in silent mode by using Phonegap (JavaScript)
is there any plugin or should I create my own plugin if yes How??

Your answer

1 Answers

answered 8 days ago by tyranid

You should create your own plugin developing-phonegap-plugins and you can set the ringer mode to silent or normal whatever you want in android using AudioManager.

AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);

You can also set the value to :

RINGER_MODE_NORMAL, RINGER_MODE_SILENT, or RINGER_MODE_VIBRATE.

Also add the following permission in the manifest file:

android.permission.MODIFY_AUDIO_SETTINGS.

http://sree.cc/google/android/code-to-change-phone-mode-to-normalsilent-or-vibrate-in-android

Related Questions

How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user.
I've been used urban airship for notification and it's working. Now client's requirement has been, he want to update a specific data (ie: current location) for client once any silent notification(no s
Is there a way to programmatically set the device my app is running on to silent mode? The silence must encompass the entire device, not just my application.
I have used this method in the past to detect if the silent switch is enabled: - (BOOL)silenced { #if TARGET_IPHONE_SIMULATOR // return NO in simulator. Code causes crashes for some reason. return NO;
How do I set the actionbar mode at runtime to not-overlay or overlay with the content at runtime? I tried using getWindow().requestFeature(Window.FEATURE_ACTIONBAR_OVERLAY) but it doesn't allow to set
We started to develop mobile apps for our existing web application by using phonegap. Here we supposed to follow different steps to build the mobile app for different operating systems. Now we started
I have done several apps with buzztouch for Iphone and Ipads, here is a free one as an example : http://itunes.apple.com/us/app/lr-basics-free-edition/id497563707?mt=8 I do not know code very much, I
I know there is the WizardSilent function for checking whether the setup runs in silent mode, but I cannot find a function equivalent for very silent mode (when the setup is executed with /VERYSILENT
So I'm trying to test this in a PhoneGap application using this method: http://inflagrantedelicto.memoryspiral.com/2013/05/phonegap-saving-arrays-in-local-storage/ I keep getting a reference error whe
I am trying to build an Android application with PhoneGap. I need to be able to use the PhoneGap WebView (super.appView) and all of its javascript magic but I also need to display some native UI contr
I am building the app for android. But then I see this: [ReferenceError: a is not defined] exec: ant clean -f /Users/chaitanya/BPEase/platforms/android/build.xml [ 'ant clean -f /Users/chaitanya/BP
I want to implement Google Maps on android using phonegap and jquery. I have followed this The below script is unable to load on android emulator. Even though I have increased the time to 6 min. If i
I am developing a HTML5 application for Android. Everything is fine all pages through application, but when it comes to an specific page of app it crashes. The crash occurs only in Samsung Galaxy Tab
I am looking for an android version of PhoneGap OCR plugin. Unfortunately I can't use the one for ocr-api-service because the OCR library is required to be local. Then I found this https://github.com/
I am new to phonegap. i want to create a plugin in phonegap using android background services. I need continuously calls to that service after every 5 seconds. Please assist me to do so. Thanks for yo
I know this may be a basic question but I cannot find a basic answer online. How do I implement JQuery Mobile on my PhoneGap app that I am developing with android? I am not clear which version I need
I am getting database: undefined in phonegap with android. I am creating some tables in phonegap and after successful creation of tables it gives me the database undefined error. please help. i am new
This question already has an answer here: PhoneGap Android: How to force Application to use icons from asset\www\res instead res\drawable folder? 1 answer I have an HTML5/Javascript app, and I
I have using cordova v3.4.1 to build android and ios app, on ios geolocation function is returning very quickly and works fine always,but on android, sometimes it not working. The strange thing is aft
I coded an application with phonegap. I have a phone numbers list that I receive from a server. when an item from a list is clicked the controller trigers this function: $scope.call = function(number)
I am working on the Samsung S Plus phone. Android version: 2.3.4 Phonegap version: 1.5.0 I am trying to record an audio bit and upload the same to the server. I am using the Capture API, capture.captu
I was trying to integrate Google+ in my phone Gap application, like twitter and facebook. But, I haven't find out any samples and Tutorials. If any one aware about that, please suggest me, how to do t
I render a local web page in Android and include locally referenced webfonts in woff, ttf and svg format (not fetched via HTTP). However, these are not rendered at all on two different devices (API 2.
Is it possible to create android homescreen widgets using phonegap ?
A while back I've worked with Eclipse and Phonegap and I've successfully deployed a few Android apps. So now I'm trying to get the new Phonegap/Cordova app up and running in Android Studio but so far
I'm developing an App using PhoneGap and HTML/Dojo in Xcode. This App display an Map after successful login. However, the challenge is how to load the map in case of Offline-mode? For Offline-mode the
I'm having what seems to be a pretty small issue in the Phonegap 1.3.0 application I am working on. It is for Android devices. The problem is stemming from the ads I am trying to incorporate into my a
I'm getting ready to set up a mobile web app I made and make it into a native app for iOS using Adobe's Phonegap Build service. Upon reading their documents on how to set everything up, it mentioned a
I am currently in the process of creating a mobile app that uses the Phonegap (Cordova) camera plugin. It correctly captures the image and displays it where I want to, but I can't seem to set the targ
I am trying to read a text file with JavaScript using Phonegap 2.0.0 on Android. I went over several examples using the File API at http://docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#File Not
I have a three audio files stored into array. I want to upload the files into server into a single request with filekey values 'utterence1','utterence2','utterence3' but in a phone gap FileTransfer me
I'm trying to get my first Android plugin to work. I've successfully registered it and able to execute it. Inside of my plugin execute action, I am trying to do the following: ctx.setContentView(R.lay
I have developed an app which is now live on Google Play store. The app uses the getCurrentPosition method to get the current location of a user. I have tested on a few devices, and the code works per
Ok so I need to give a bit of background. First I am using jquery-mobile with PhoneGap 1.7. I have coded a very simple Java server that uses the ServerSocket object. On the Android phone, I connect to
I downloaded the push notification sample project from MarkNutter Project and imported it as android project its working fine as of now I am able to register from device Since I do not have some serv
I have 3 list view named activities-today, activities-this week, activities-this month. I want to use collapsible list view format to show the lists. I've seen an example of collapsible list view usi
If I change the project build target in a Phonegap app I get Unfortunately has stopped unexpectedly I have made app with a target build path of 4.0.3 and set the min-sdk to 7. The app will run fine
I'm currently using cordova 3.7.1. In my app I'm not able to detect the hardware back button in my jquery script. I trying out like this: $(document).ready(function() { //registering the back button d
I've intergrated admob into my android phonegap app using the smartphone web method. In test mode, test ad will be shown everytime i open the app. Testing with live ad also a success, although sometim
I've been searching for an answer but it seems most of what I've found is for older versions of PhoneGap. Here is my link code: <a href=# onclick=window.open('http://acq.com/account/', '_system
I've been searching the internet for hours and can't seen to find a fix for my issue. I've created a simple Phonegap app and now I want to link out to an external webpage. I'm running Cordova 3.0 and
I am new to Phonegap development. I had developed an app and unfortunately i have lost the entire code. But luckily i have the apk file. Can any one pls help me to extract my code from the apk file (P
I have done with the server side coding with deviceId, apiKey and senderId. May I know why I still get this Invalid Registration ??
I want my Phonegap App to open a Flash-Webpage in the Android Browser, not in Webview. I tried it with a normal HTML Anchor Tag. This doestn't work. Window.open also opens the page internally and I ge
I have an app that has a list as its main activity and then you can click items which opens a detailed view of that item. I also have a search activity that is similar to the main activity and works a
I want to use the immersive mode in my app. I am following the documentation and working properly: private View mDecorView; ... @Override public void onWindowFocusChanged(boolean hasFocus) { super.
It's been few days now that I'm stick in the same problem so I finally comes up to ask the community. I will try to make it as clear as possible. I'm actually trying to add in a asynchronous way some
I'm building an Android application and would like to maintain a few environment variables that I can tweak depending on whether I'm in development mode or release mode. For example, I need to invoke
I added the following code to the localconf.php: $TYPO3_CONF_VARS['BE']['adminOnly'] = '2'; $TYPO3_CONF_VARS['FE']['pageUnavailable_force'] = '1'; $TYPO3_CONF_VARS['FE']['pageUnavailable_handling'] =
Is it possible to set width or height of HTML element (ex. <div>) in JavaScript in Standards Mode? Note the following code: <html> <script language=javascript type=text/javascript&g
...