无论是用户还是10056当前进程android.permission.MODIFY_PHONE_STATE [英] Neither user 10056 nor current process has android.permission.MODIFY_PHONE_STATE
问题描述
我要创造这样的,我想通话过程中打开与指定号码的拨号器应用程序。
I want to create such an application in which i want to open a dialer with specified number during call.
我曾与refrence这个<一个在通话过程中成功打开拨号器href="http://stackoverflow.com/questions/12109554/android-dialing-a-custom-number-once-call-picked-up">LINK但不能拨打该号码,而另一个问题是,code不工作上面的Android 2.2。有没有其他的方法,使这项工作中的所有设备。
I have successfully opened the dialer during a call with refrence of this LINK but not able to dial the number, and another issue is that code is not working above Android 2.2. is there any other way to make this working in all devices.
code:
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephonyService;
telephonyService = (ITelephony)m.invoke(tm);
// Silence the ringer and answer the call!
telephonyService.silenceRinger();
telephonyService.answerRingingCall();
telephonyService.showCallScreen();
telephonyService.showCallScreenWithDialpad(true);
错误日志:
01-09 17:35:41.065: W/Resources(367): Converting to string: TypedValue{t=0x10/d=0x2 a=-1}
01-09 17:38:23.446: W/System.err(367): java.lang.SecurityException: Neither user 10056 nor current process has android.permission.MODIFY_PHONE_STATE.
01-09 17:38:23.446: W/System.err(367): at android.os.Parcel.readException(Parcel.java:1322)
01-09 17:38:23.446: W/System.err(367): at android.os.Parcel.readException(Parcel.java:1276)
01-09 17:38:23.446: W/System.err(367): at com.android.internal.telephony.ITelephony$Stub$Proxy.silenceRinger(ITelephony.java:549)
01-09 17:38:23.446: W/System.err(367): at com.everysoft.autoanswer.AutoAnswerIntentService.answerPhoneAidl(AutoAnswerIntentService.java:137)
01-09 17:38:23.446: W/System.err(367): at com.everysoft.autoanswer.AutoAnswerIntentService.onHandleIntent(AutoAnswerIntentService.java:94)
01-09 17:38:23.446: W/System.err(367): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
01-09 17:38:23.446: W/System.err(367): at android.os.Handler.dispatchMessage(Handler.java:99)
01-09 17:38:23.446: W/System.err(367): at android.os.Looper.loop(Looper.java:123)
01-09 17:38:23.446: W/System.err(367): at android.os.HandlerThread.run(HandlerThread.java:60)
的Manifest.xml
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
修改
我能够自动接听电话中的所有设备,但只有在打开拨号盘有问题。
I am able to auto answer the call in all devices but having problem with opening a dialpad only.
任何建议和想法将AP preciated。
Any suggestion and idea will be appreciated .
感谢
Juned汗
Thanks
Juned Khan
推荐答案
您是否尝试过像波纹管?
Have you tried like bellow ?
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:1231231234"));
startActivity(intent);
这篇关于无论是用户还是10056当前进程android.permission.MODIFY_PHONE_STATE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!