How do I test my Dock Application

前端 未结 2 443
自闭症患者
自闭症患者 2021-02-03 14:34

I don\'t have a Dock, but I\'m writing an Dock replacement app. Can I simulate the Clock Dock somehow? I know I can for the Car Dock, but that\'s not the dock I\'m replacing.

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-03 15:17

    The adb command above is almost correct. you need to use --ei and not -ei. the full command I use to simulate docked to car is:

    am broadcast -a android.intent.action.DOCK_EVENT --ei android.intent.extra.DOCK_STATE 2
    

    execute this command from the adb console and that should do it (no permission issues since adb runs in root context)

    Only thing missing it that this is supposed to be a sticky broadcast and I don't think there is any way setting it as sticky using adb.

提交回复
热议问题