我有一个简单的测试用例,用于测试是否在按钮点击时启动了拨出呼叫.
public void testCalling(){
IntentFilter callFilter = new IntentFilter();
callFilter.addAction(Intent.ACTION_CALL);
callFilter.addCategory(Intent.CATEGORY_DEFAULT);
callFilter.addDataScheme("tel:");
ActivityMonitor mMonitor = new ActivityMonitor(callFilter,null,false);
getInstrumentation().addMonitor(mMonitor);
mSolo.clickOnText("CALL");
assertTrue(0 < mMonitor.getHits());
sendKeys(KeyEvent.KEYCODE_ENDCALL);
}
虽然调用了Intent(传出调用),但我的ActivityMonitor无法注册它.
堆栈跟踪是
05-28 17:11:09.183: I/ActivityManager(71): Starting activity: Intent { act=android.intent.action.CALL dat=tel:+xxxxxxx cmp=com.android.phone/.OutgoingCallBroadcaster }
请帮忙
我能找到的唯一其他资源是android开发者组的this discussion which ended without any solution
最佳答案