MIUI系统对外拨打电话

点击按钮实现拨打电话(这个功能已经实现了)
今天在MIUI系统上测试,提示说“正尝试接收短信,此操作可能产生危险,是否允许本次操作,注意:禁止某些程序的请求会引起该程序的崩溃”
如果选择允许的话,可以正常拨打电话
如果选择禁止的话,程序就崩溃了(MIUI系统提示说“出问题了,等我去修理,立即关闭或马上报修”)

我在Manifest里面是加入了权限的:<uses-permission android:name="android.permission.CALL_PHONE"/>

  1. 10-24 09:21:15.722: W/ActivityManager(126): Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{407cc6e8 20443:lyc.iping/10046} (pid=20443, uid=10046) requires android.permission.CALL_PHONE
  2. 10-24 09:21:15.732: D/AndroidRuntime(20443): Shutting down VM
  3. 10-24 09:21:15.732: W/dalvikvm(20443): threadid=1: thread exiting with uncaught exception (group=0x4007a568)
  4. 10-24 09:21:15.742: E/AndroidRuntime(20443): FATAL EXCEPTION: main
  5. 10-24 09:21:15.742: E/AndroidRuntime(20443): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{407cc6e8 20443:lyc.iping/10046} (pid=20443, uid=10046) requires android.permission.CALL_PHONE
  6. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.os.Parcel.readException(Parcel.java:1322)
  7. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.os.Parcel.readException(Parcel.java:1276)
  8. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1359)
  9. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
  10. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.Activity.startActivityForResult(Activity.java:2851)
  11. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.Activity.startActivity(Activity.java:2957)
  12. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at lyc.iping.NearByActivity.onListItemClick(NearByActivity.java:288)
  13. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.ListActivity$2.onItemClick(ListActivity.java:319)
  14. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
  15. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.widget.ListView.performItemClick(ListView.java:3535)
  16. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1827)
  17. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.os.Handler.handleCallback(Handler.java:587)
  18. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.os.Handler.dispatchMessage(Handler.java:92)
  19. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.os.Looper.loop(Looper.java:130)
  20. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at android.app.ActivityThread.main(ActivityThread.java:3703)
  21. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at java.lang.reflect.Method.invokeNative(Native Method)
  22. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at java.lang.reflect.Method.invoke(Method.java:507)
  23. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  24. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  25. 10-24 09:21:15.742: E/AndroidRuntime(20443):     at dalvik.system.NativeStart.main(Native Method)
  26. 10-24 09:21:15.762: W/ActivityManager(126):   Force finishing activity lyc.iping/.NearByActivity

可以看到错误是由于权限问题造成的。虽然后面用了try{}catch{}。把错误个捕获到。但是不能解决本质的问题。最后发现是因为MIUI对系统进行了定制。

你可能感兴趣的:(android,拨打电话,miui)