2013-09-26 57 views
5

我正在嘗試在Google Glass上運行Android應用來撥打電話。這是調用意圖的代碼:Google Glass GDK支持Intent.ACTION_CALL嗎?

String uri = "tel:+44....." ; 
Intent intent = new Intent(Intent.ACTION_CALL); 
intent.setData(Uri.parse(uri)); 
startActivity(intent); 

而這會引發以下異常。

09-26 21:57:05.880: E/AndroidRuntime(4995): FATAL EXCEPTION: main 
09-26 21:57:05.880: E/AndroidRuntime(4995): android.content.ActivityNotFoundException: 
    No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxxx } 
09-26 21:57:05.880: E/AndroidRuntime(4995): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxxx } 

我的玻璃是藍牙拴到我的手機,我可以得到它,以與呼叫「OK玻璃,使呼叫......」命令。我是否錯過了一些東西,或者這個Intent目前不支持Glass嗎?

+0

我看到了同樣的問題,當我嘗試它。我的猜測是一個包含Call intent的apk需要另外通過adb install來加載(很像語音識別庫)。或者有一個GDK特定的意圖,我們都還沒有知道...... – Bill

+0

在鏡像API中它叫做VOICE_CALL,你可以嘗試用「android.intent.action.VOICE_CALL」或類似的東西啓動Intent。 –

回答

1

這似乎是一個尚未啓動的GDK相關問題,請隨時在我們的issues tracker上提交功能請求,我們將相應地更新錯誤。

+2

完成 - https://code.google.com/p/google-glass-api/issues/detail?id=209 – Kevin

4

這是可以做到這樣,現在:

Intent localIntent = new Intent(); 
localIntent.putExtra("com.google.glass.extra.PHONE_NUMBER", "123-123-123"); 
localIntent.setAction("com.google.glass.action.CALL_DIAL"); 
sendBroadcast(localIntent); 
+1

但這樣做會凍結「通話」活動,以防玻璃沒有連接到設備能力。有沒有簡單的方法來檢查玻璃綁定狀態? (我已在GDK問題209中添加了評論。) – joshis