简体   繁体   中英

Sip Profile Building:Android

I could build a sip profile using SipProfile.Builder class. I used following snippet of code to do it:

 if (SipManager.isApiSupported(MyActivity.this)&& SipManager.isVoipSupported(MyActivity.this)) {

SipManager manager=SipManager.newInstance(this);
    SipProfile.Builder builder;try {
                                builder = new Builder(userName,domainName);
                            } catch (ParseException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }                                                           manager = SipManager.newInstance(MyActivity.this);
                            builder.setPassword(password);

                            profile = builder.build();
                            try {
                                manager.open(profile);
                            } catch (SipException e) {


                // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        try {
                            manager.register(profile, 30, MyActivity.this);
                        } catch (SipException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        Toast.makeText(MyActivity.this, "created",
                                Toast.LENGTH_LONG).show();

                        } else {
                    Toast.makeText(MyActivity.this, "Not Supported",
                            Toast.LENGTH_LONG).show();
                }

It shows as a sip account in the settings/callsettings/Internet call settings. Problem is i could not make it as primary account. How can i make it as primary account?

This information is account-based (primary email address for person, primary phone number, primary SIP account etc.) so it's stored in the phone's contacts-book.

It seems to me it's an option that is set per-data, per-account (for example: this type of data (email/phone/sip-addr) set it as primary). You can set data as primary for a contact using IS_PRIMARY or IS_SUPER_PRIMARY

IS_PRIMARY: Whether this is the primary entry of its kind for the raw contact it belongs to.

The data you should use it on is ContactsContract.CommonDataKinds.SipAddress . I hope that's useful as starting point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM