테스트 한 앱 내부에서 Instrumentation 인터페이스로 내 앱을 계측하고 싶습니다. 모든 활동을 확장하는 사용자 지정 활동이 있습니다. InstrumentationRobot.class에서 계측 코드를 사용하여 응용 프로그램을 다시 시작해야합니다startInstrumentation이있는 인스 트루먼트 Android 앱
public class BxActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
...
boolean instru = startInstrumentation(new ComponentName(BxActivity.this, InstrumentationRobot.class), null, null);
이럴 : 그 나는 앱에 대한 정보를 얻을 수있는 계측을 시작합니다. 동일한 Android 프로젝트 및 패키지에 있습니다.
public class InstrumentationRobot extends Instrumentation {
@Override
public void onCreate(Bundle arguments) {
super.onCreate(arguments);
Log.v("InstrRobot", "Hello from Robot");
start();
}
나는이 같은 매니페스트에 장비를 추가했습니다 :
<instrumentation
android:name="InstrumentationRobot" (class in the same pkg)
android:targetPackage="my.package.name" />
</application>
이, 나에게 나의 작은 로봇 출력합니다 "안녕하세요"내 기기에 대한 올바른 매니페스트 코드입니다.
감사합니다, 나는 해결책을 발견하고 올바른 코드 내 질문에 업데이 트했습니다