美好的一天。 我對android開發相當陌生。您對此問題的回覆將不勝感激。是否有可能讓SEND-SMS和RECEIVE_SMS在單個項目中使用權限?
在我的項目中,我必須接收和發送短信。對於接收部分,我使用廣播接收器,發送部分使用正常的活動。這裏廣播接收器接收短信並將一些數據傳送到剛剛提到的活動。然後活動執行一些任務併產生一些結果。我需要將這些結果作爲短信發送。
我已經使用SEND_SMS和RECEIVE_SMS在清單文件中使用權限。但是這個應用程序在模擬器上給了我一個例外。但是當我在兩個獨立的項目中測試發送部分和接收部分時,它沒有任何例外地正常工作。所以我想代碼(或邏輯)沒有錯。 現在,爲什麼拋出這個異常?是否有可能讓SEND_SMS和RECEIVE_SMS使用同一個項目(同一個清單)的權限? 我已經使用SmsManager發送短信。 您的迴應將不勝感激。
這裏是logcat的細節:
11-22 12:26:00.355: ERROR/Zygote(33): setreuid() failed. errno: 2
11-22 12:26:09.295: ERROR/Zygote(33): setreuid() failed. errno: 17
11-22 12:26:11.125: ERROR/BatteryService(66): usbOnlinePath not found
11-22 12:26:11.125: ERROR/BatteryService(66): batteryVoltagePath not found
11-22 12:26:11.125: ERROR/BatteryService(66): batteryTemperaturePath not found
11-22 12:26:11.155: ERROR/SurfaceFlinger(66): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
11-22 12:26:32.497: ERROR/EventHub(66): could not get driver version for /dev/input/mouse0, Not a typewriter
11-22 12:26:32.605: ERROR/EventHub(66): could not get driver version for /dev/input/mice, Not a typewriter
11-22 12:26:33.756: ERROR/System(66): Failure starting core service
11-22 12:26:33.756: ERROR/System(66): java.lang.SecurityException
11-22 12:26:33.756: ERROR/System(66): at android.os.BinderProxy.transact(Native Method)
11-22 12:26:33.756: ERROR/System(66): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
11-22 12:26:33.756: ERROR/System(66): at android.os.ServiceManager.addService(ServiceManager.java:72)
11-22 12:26:33.756: ERROR/System(66): at com.android.server.ServerThread.run(SystemServer.java:184)
11-22 12:26:38.805: ERROR/SoundPool(66): error loading /system/media/audio/ui/Effect_Tick.ogg
11-22 12:26:38.815: ERROR/SoundPool(66): error loading /system/media/audio/ui/KeypressStandard.ogg
11-22 12:26:38.815: ERROR/SoundPool(66): error loading /system/media/audio/ui/KeypressSpacebar.ogg
11-22 12:26:38.825: ERROR/SoundPool(66): error loading /system/media/audio/ui/KeypressDelete.ogg
11-22 12:26:39.035: ERROR/SoundPool(66): error loading /system/media/audio/ui/KeypressReturn.ogg
11-22 12:26:50.545: ERROR/ThrottleService(66): Could not open GPS configuration file /etc/gps.conf
11-22 12:26:57.865: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
11-22 12:26:57.995: ERROR/logwrapper(152): executing /system/bin/tc failed: No such file or directory
11-22 12:26:58.005: ERROR/logwrapper(153): executing /system/bin/tc failed: No such file or directory
11-22 12:27:12.875: ERROR/ActivityManager(66): ANR in com.android.settings
11-22 12:27:12.875: ERROR/ActivityManager(66): Reason: Broadcast of Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS cmp=com.android.settings/.widget.SettingsAppWidgetProvider (has extras) }
11-22 12:27:12.875: ERROR/ActivityManager(66): Load: 2.93/0.78/0.26
11-22 12:27:12.875: ERROR/ActivityManager(66): CPU usage from 10994ms to 2618ms ago:
11-22 12:27:12.875: ERROR/ActivityManager(66): ronsoft.openwnn: 209% = 122% user + 86% kernel/faults: 3908 minor 5 major
11-22 12:27:12.875: ERROR/ActivityManager(66): m.android.phone: 168% = 84% user + 84% kernel/faults: 3177 minor 7 major
11-22 12:27:12.875: ERROR/ActivityManager(66): system_server: 150% = 118% user + 31% kernel/faults: 428 minor 3 major
11-22 12:27:12.875: ERROR/ActivityManager(66): ndroid.launcher: 118% = 65% user + 52% kernel/faults: 2921 minor 3 major
11-22 12:27:12.875: ERROR/ActivityManager(66): ndroid.settings: 118% = 47% user + 70% kernel/faults: 2956 minor 7 major
11-22 12:27:12.875: ERROR/ActivityManager(66): bootanimation: 18% = 15% user + 2% kernel
11-22 12:27:12.875: ERROR/ActivityManager(66): app_process: 13% = 9% user + 4% kernel/faults: 241 minor
11-22 12:27:12.875: ERROR/ActivityManager(66): adbd: 11% = 0% user + 11% kernel
11-22 12:27:12.875: ERROR/ActivityManager(66): TOTAL: 100% = 70% user + 29% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): ANR in jp.co.omronsoft.openwnn
11-22 12:27:22.035: ERROR/ActivityManager(66): Reason: Executing service jp.co.omronsoft.openwnn/.OpenWnnJAJP
11-22 12:27:22.035: ERROR/ActivityManager(66): Load: 3.31/0.94/0.32
11-22 12:27:22.035: ERROR/ActivityManager(66): CPU usage from 10962ms to 1406ms ago:
11-22 12:27:22.035: ERROR/ActivityManager(66): system_server: 47% = 34% user + 12% kernel/faults: 511 minor
11-22 12:27:22.035: ERROR/ActivityManager(66): app_process: 15% = 14% user + 1% kernel/faults: 420 minor
11-22 12:27:22.035: ERROR/ActivityManager(66): ronsoft.openwnn: 9% = 7% user + 1% kernel/faults: 394 minor
11-22 12:27:22.035: ERROR/ActivityManager(66): ndroid.launcher: 9% = 6% user + 2% kernel/faults: 741 minor
11-22 12:27:22.035: ERROR/ActivityManager(66): bootanimation: 6% = 5% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): m.android.phone: 6% = 4% user + 1% kernel/faults: 267 minor
11-22 12:27:22.035: ERROR/ActivityManager(66): adbd: 1% = 0% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): logcat: 1% = 0% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): events/0: 0% = 0% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): servicemanager: 0% = 0% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): -ndroid.settings: 0% = 0% user + 0% kernel
11-22 12:27:22.035: ERROR/ActivityManager(66): TOTAL: 100% = 75% user + 25% kernel
11-22 12:27:33.342: ERROR/HierarchicalStateMachine(66): TetherMaster - unhandledMessage: msg.what=3
您可以向我們展示在使用兩種權限時引發的異常的LogCat堆棧跟蹤嗎?對於你所知道的,在你的代碼中可能有些問題。 –
那麼,正如我指定的那樣,當模擬器運行時引發異常。 「應用程序ProjectName(process packageName)已意外停止,請重試。」 感謝您的關注Mr. Matt Quiros – Adeesha
我的意思是,如果您使用Eclipse編寫應用程序,應該是一個名爲「LogCat」的窗口,其中所有的系統消息(而不是您的示例中的對話框)都位於該窗口中。您可以通過轉至窗口 - >顯示視圖 - >其他 - > Android - > LogCat來打開LogCat,然後運行程序,並且當您看到一大塊紅色的消息時,將其粘貼到此處。 –