Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accesing phone settings via code.

 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start looking in the android.telephony package.
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Perry Hoekstra.
It is really helpful to me.
Once again thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic