How do I test my Dock Application

2019-03-11 10:21发布

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.

Can I flip my device to Desk Mode through ADB somehow? Maybe with something like? ADB shell sendevent XXX

Thanks

3条回答
ゆ 、 Hurt°
2楼-- · 2019-03-11 10:55

It works by magnet so if you have place a strong enough magnet near the back of the device it will think its on a dock. I don't think that will hurt anything in the device either.

查看更多
冷血范
3楼-- · 2019-03-11 11:07

There's a free app called Dockrunner that puts your phone into Dock mode.

UPDATE: Humpf, seems like it's been removed from the market. Have you tried just broadcasting the ACTION_ENTER_DESK_MODE and ACTION_ENTER_CAR_MODE intents from a separate application?

查看更多
闹够了就滚
4楼-- · 2019-03-11 11:08

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.

查看更多
登录 后发表回答