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?
PhoneFactory.getDefaultPhone must be called from Looper thread
3.2k views Asked by user1597692 At
2
There are 2 answers
1
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
Did you call
PhoneFactory.makeDefaultPhone(getApplicationContext())
beforePhoneFactory.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