###前提・実現したいこと
android.net.sip APIを使った電話アプリを作っています。
サンプルの SipDemo の処理をほぼそのまま流用しているのですが、動作しません。
###発生している問題・エラーメッセージ
ほぼ SipDemo からソースをコピペしています。
SipManager#open の後に、SipManager#setRegistrationListenerでリスナーを設定するのですが、コールバックが全く呼ばれない状態です。
###該当のソースコード
try { SipProfile.Builder builder = new SipProfile.Builder(username, domain); builder.setPassword(password); me = builder.build(); Intent i = new Intent(); i.setAction("com.mydomain.myapplication.INCOMING_CALL"); PendingIntent pi = PendingIntent.getBroadcast(MainActivity.this, 0, i, Intent.FILL_IN_DATA); manager.open(me, pi, null); // This listener must be added AFTER manager.open is called, // Otherwise the methods aren't guaranteed to fire. manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() { public void onRegistering(String localProfileUri) { updateStatus("Registering with SIP Server..."); } public void onRegistrationDone(String localProfileUri, long expiryTime) { updateStatus("Ready"); } public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) { updateStatus("Registration failed. Please check settings."); } }); } catch (ParseException pe) { updateStatus("Connection Error."); } catch (SipException se) { updateStatus("Connection error."); }
マニフェストなども正しく書き、権限も与えています。
###試したこと
同じデバイス(nexus 7 2013)上で、サンプルの SipDemo は問題なく動作していますが、ほぼそのまま流用したテストプロジェクト(上記)ではコールバックに反応がない。
その後、SipDemo とパッケージ名以外はほぼ同じのプロジェクトを新規作成してみました(SipDemo2)。
SipDemo2 を動かしてみると、onRegistrationFailed にきましたが、レジ成功はしません。以下の質問者と同じ状態です。
http://stackoverflow.com/questions/42627285/android-sipmanager-registration-failed/42756635
かつ、なぜか元のSipDemo の方がコールバックが呼ばれなくなりました。。。
###補足情報(言語/FW/ツール等のバージョンなど)
Android Studio 2.3.1
Android 6.x (Nexus 7)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/07 01:52
2017/05/07 02:01
2017/05/07 04:16
2017/05/07 10:40