Code example for SipProfile

Methods: getUri, getUriString

0
        return null; 
    } 
 
    private void addPreferenceFor(SipProfile p) {
        String status;
        Log.v(TAG, "addPreferenceFor profile uri" + p.getUri());
        SipPreference pref = new SipPreference(this, p);
        mSipPreferenceMap.put(p.getUriString(), pref);
        mSipListContainer.addPreference(pref);
 
        pref.setOnPreferenceClickListener(
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(Preference pref) {
                        handleProfileClick(((SipPreference) pref).mProfile);
                        return true; 
                    } 
                }); 
    } 
 
    private void handleProfileClick(final SipProfile profile) {
        int uid = profile.getCallingUid();
        if (uid == mUid || uid == 0) {
            startSipEditor(profile);
            return; 
        } 
        new AlertDialog.Builder(this)
                .setTitle(R.string.alert_dialog_close)
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setPositiveButton(R.string.close_profile, 
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int w) {
                                deleteProfile(profile);
                                unregisterProfile(profile);
                            } 
                        }) 
                .setNegativeButton(android.R.string.cancel, null)
                .show(); 
    } 
 
    private void unregisterProfile(final SipProfile p) {
        // run it on background thread for better UI response 
        new Thread(new Runnable() {
            public void run() { 
                try { 
                    mSipManager.close(p.getUriString());
                } catch (Exception e) {
                    Log.e(TAG, "unregister failed, SipService died?", e);
                } 
            } 
        }, "unregisterProfile").start();
    } 
 
    void deleteProfile(SipProfile p) {
        mSipProfileList.remove(p);
        SipPreference pref = mSipPreferenceMap.remove(p.getUriString());
        mSipListContainer.removePreference(pref);
    } 
 
    private void addProfile(SipProfile p) throws IOException {
        try { 
            mSipManager.setRegistrationListener(p.getUriString(),
                    createRegistrationListener()); 
        } catch (Exception e) {
            Log.e(TAG, "cannot set registration listener", e);
        } 
        mSipProfileList.add(p);
        addPreferenceFor(p);
    } 
 
    private void startSipEditor(final SipProfile profile) {
        mProfile = profile;