I guess it would not work for SIP. You can have a look at the below link. http://developer.android.com/reference/android/net/sip/SipSession.State.html
On Feb 13, 9:52 am, Jagruti Sangani <[email protected]> wrote: > Hello, > Is it work for sip calling?Because in that i have still not use > theTelephonyManager and now i want to get cthe state of calling.So please > reply is it work for sip calling. > > > > > > > > On Sat, Feb 11, 2012 at 11:58 PM, Nitin Sethi <[email protected]> wrote: > > here it is.. full code I have pasted down... Specifically this line I > > added. > > > ((TelephonyManager) context > > > .getSystemService(Context.TELEPHONY_SERVICE)).getCallState() == > > TelephonyManager.CALL_STATE_RINGING > > > if (((TelephonyManager) context > > > .getSystemService(Context.TELEPHONY_SERVICE)).getCallState() == > > TelephonyManager.CALL_STATE_RINGING) { > > > String number = intent > > > .getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); > > > if (number.equals("+919663487031") || > > number.equals("9742431366")) > > { // My > > > // Gf's > > > // Number > > > // :D > > AudioManager vAudioManager = > > (AudioManager) context > > > .getSystemService(Context.AUDIO_SERVICE); > > int maxVolume = vAudioManager > > > .getStreamMaxVolume(AudioManager.STREAM_RING); > > > vAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); > > > vAudioManager.setStreamVolume(AudioManager.STREAM_RING, > > maxVolume, > > AudioManager.FLAG_SHOW_UI); > > } else { > > Toast.makeText(context, "Forget it", > > Toast.LENGTH_LONG).show(); > > } > > > } > > > On Feb 11, 6:50 pm, Jagruti Sangani <[email protected]> > > wrote: > > > Canyou please post the cade about getcallstate() > > > > On Sat, Feb 11, 2012 at 6:16 PM, Nitin Sethi <[email protected]> > > wrote: > > > > Hi All, > > > > > I could finally sort out this issue. It so turns out that the > > > > Broadcast Intent i want to receive doesn't linger for long enough for > > > > your receiver to consume it and process it. In technical words, the > > > > intent is NOT STICKY. Hence, I had to get the state using the method > > > > getCallState() to process the Intent. :) > > > > > On Feb 11, 3:59 pm, Nitin Sethi <[email protected]> wrote: > > > > > Hi All, > > > > > > I have been trying very hard to get it work in my Gingerbread 2.3.5 > > > > > phone but with no success. I have read all the posts and have come up > > > > > with the below code which works very rarely. I suspect it has > > > > > permissions issue but could not zero in on the issue which is bugging > > > > > me for long. > > > > > > My Manifest: > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > > > > > package="utils.self.puttu" > > > > > android:versionCode="1" > > > > > android:versionName="1.0" > > > > > > > <uses-sdk android:minSdkVersion="10" /> > > > > > > <uses-permission > > > > > android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> > > > > > <uses-permission > > > > > android:name="android.permission.READ_PHONE_STATE" /> > > > > > > <application > > > > > > <receiver android:name=".PersonalisedSetting" > > > > > > <intent-filter > > > > > > <action > > > > > android:name="android.intent.action.PHONE_STATE" /> > > > > > </intent-filter> > > > > > </receiver> > > > > > </application> > > > > > > </manifest> > > > > > > My Receiver: > > > > > > package utils.self.puttu; > > > > > > import android.content.BroadcastReceiver; > > > > > import android.content.Context; > > > > > import android.content.Intent; > > > > > import android.media.AudioManager; > > > > > import android.telephony.TelephonyManager; > > > > > import android.widget.Toast; > > > > > > public class PersonalisedSetting extends BroadcastReceiver { > > > > > // private PhoneStateListener myListener = null; > > > > > @Override > > > > > public void onReceive(Context context, Intent intent) { > > > > > > // if > > > > (intent.getStringExtra(TelephonyManager.EXTRA_STATE) == > > > > > // TelephonyManager.CALL_STATE_RINGING) > > > > > > String number = intent > > > > > .getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); > > > > > > if (number.equals("+919742431366") || > > > > number.equals("9742431366")) > > > > > { // My Gf's Number :D > > > > > AudioManager vAudioManager = (AudioManager) > > > > context > > > > > .getSystemService(Context.AUDIO_SERVICE); > > > > > int maxVolume = vAudioManager > > > > > .getStreamMaxVolume(AudioManager.STREAM_RING); > > > > > vAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); > > > > > vAudioManager.setStreamVolume(AudioManager.STREAM_RING, maxVolume, > > > > > AudioManager.FLAG_SHOW_UI); > > > > > } else { > > > > > Toast.makeText(context, "Forget it", > > > > Toast.LENGTH_LONG).show(); > > > > > } > > > > > > } > > > > > > } > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to > > [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected] > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

