aspose file tools*
The moose likes Android and the fly likes Accesing phone settings via code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Accesing phone settings via code." Watch "Accesing phone settings via code." New topic
Author

Accesing phone settings via code.

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi,

I want to access current phone settings through my application.Like I want to know that in which mode my phone is..
whether it is in ringing mode or in silent or attached with blue tooth device.

So what I want to know is that is there any API available for that?
Misha van Tol
Ranch Hand

Joined: Jan 02, 2010
Posts: 56

I would start looking in the android.telephony package.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
android.telephony is good one more is also there called android.accessibilityservice.


Actually I want to find how to by pass the lock of android device.
I mean even if my phone is locked. If I long press menu button or anything t should by pass that lock and command should go application.

Any idea how to do that..
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hardik Trivedi wrote:android.telephony is good one more is also there called android.accessibilityservice.


I searched a lot in this package but did not find it useful.

I also want to know that whether I can know that in which state the phone is..
For example I want to know that is phone in vibrating mode. By knowing that I want to do some action.
I know that we can vibrate the phone by writing our own code. Same way there should be something which return the state of phone.
Perry Hoekstra
Greenhorn

Joined: Dec 07, 2010
Posts: 28
To determine if the phone is in vibrate mode, I would recommend using the AudioManager class: http://developer.android.com/reference/android/media/AudioManager.html



Now, to access this, I don't believe you need to indicate it in the manifest file. However, if you change it, there is a: MODIFY_AUDIO_SETTINGS


In the case of wanting to make the phone vibrate, you use the Vibrator class.

First, you need to allow the functionality through the manifest file:



and within your application:



You can also make it pulse (think Morse Code):



The JavaDoc can be found here: http://developer.android.com/reference/android/os/Vibrator.html

Perry Hoekstra
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Thanks a lot Perry Hoekstra.
It is really helpful to me.
Once again thank you very much.
 
Don't get me started about those stupid light bulbs.
 
subject: Accesing phone settings via code.
 
Similar Threads
landscape mode
Mobile Phone of your choice
How to unlock the android device.
Performance in Android
iPhone Functionality Question