PhoneFactory.getDefaultPhone must be called from Looper thread

3.2k views Asked by At

I call PhoneFactory.getDefaultPhone() in the callVoicemail() function in TwelveKeyDialer.java, then I get this log message as the title describes, and the twelveKeyDialer app crashes, how does this happen? How can I solve this problem?

2

There are 2 answers

0
user3913384 On

Did you call PhoneFactory.makeDefaultPhone(getApplicationContext()) before PhoneFactory.getDefaultPhone()?

In my experience you can call it in in the Activity create method.

You will need to add MODIFY_PHONE_STATE permission and sign the application with the system keys if you need to make changes to the phone.You will need to use the android:sharedUserId="android.uid.system" the manifest tag.

Shlomo Kut

1
nandeesh On

You are Calling the PhoneFactory.getDefaultPhone() from a thread other than Main thread. You need to call this from a thread which has called Looper.prepare().

Easiest way is to call this from UI thread. Use RunonUithread