开发者

Deliver test params using adb shell am start command

  • I wish to know how in java I should receive these parameters.

  • I do know how开发者_开发百科 to deliver parameters via adb shell am start command but I still have a

    problem to get them in java (android) code.

My class extends InstrumentationTestCase and not Activity class!!!

So I cannot perform: this.getIntent().

I anderstand that I need to create intent doing: Intent intent = new Intent(Intent.someAction);

Can you help me to find out what action should I use here.

I also read that there are secondary attributes: category, type, component, extras. I know that I also need to update the manifest file accordingly. Sorry for so many q/a.

Thanks a lot for your assist.


You can use "adb shell am" for several things: - manually start activities using intents - manually broadcast intents (for broadcastreceivers mostly) - start an Instrumentation - ...

It seems most of your question is about the concept Intent. It would be good to read upon that.


  1. Create a class that extends InstrumentationTestRunner,
  2. Override the method onCreate(Bundle args), and
  3. configure your AndroidManifest.xml to use this new runner.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜