如何修复 ussd 代码错误?

How to fix ussd code error?

我的Logcat:

08-23 01:32:12.806    1299-1299/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.haftasia.easycode, PID: 1299
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxx cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{43f9a738 1299:com.haftasia.easycode/u0a181} (pid=1299, uid=10181) requires android.permission.CALL_PHONE
            at android.os.Parcel.readException(Parcel.java:1472)
            at android.os.Parcel.readException(Parcel.java:1426)
            at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2109)
            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419)
            at android.app.Activity.startActivityForResult(Activity.java:3442)
            at android.app.Activity.startActivityForResult(Activity.java:3403)
            at android.app.Activity.startActivity(Activity.java:3645)
            at android.app.Activity.startActivity(Activity.java:3613)
            at com.haftasia.easycode.Day_3G_Mci.onClick(Day_3G_Mci.java:52)
            at android.view.View.performClick(View.java:4448)
            at android.view.View$PerformClick.run(View.java:18461)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5065)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)

既然 logcat 已经说明了您要查找的所有内容,您为什么不尝试添加权限?

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> 

您似乎有一个拨打电话的意图,但是任何应用程序拨打电话都需要获得许可。

要将其添加到 Manifest 中,在应用程序标记之前添加以下内容

<uses-permission android:name = "android.permission.CALL_PHONE"/>

您必须在 AppManifest.xml 中添加此权限:

<uses-permission android:name="android.permission.CALL_PHONE" />

你的错误是因为你没有添加。