M2真机模拟事件
需求:是想设计开发一款淘宝手机(android)的客户端的刷红包插件。 部分参考http://blog.csdn.net/chaihuasong/article/details/9159323 http://wenku.baidu.com/link?url=xHtaog9mpgVQE7oU02k1Lz3FoqKYqvpbRmSycNv63okGL6cI4UaFBw7HaN02ZWouaIc2pIBrdYxNEH
需求:是想设计开发一款淘宝手机(android)的客户端的刷红包插件。
部分参考http://blog.csdn.net/chaihuasong/article/details/9159323
http://wenku.baidu.com/link?url=xHtaog9mpgVQE7oU02k1Lz3FoqKYqvpbRmSycNv63okGL6cI4UaFBw7HaN02ZWouaIc2pIBrdYxNEHyNuVj0J1kY8efgcw2mSGlMfG4IKiO
http://my.oschina.net/zhangqingcai/blog/36272
解压D:\16教程之家\视频教程\01Android教程\android-documents下的sdk,设置好adb的path路径,并安装好手机驱动。
在控制台键入如图所示:

表示驱动安装成功。而非模拟器。
然后可以利用下图所示,查看本机的事件列表:
很明显的是event1为powerkey,也就是电源键。
adb的作用:
http://www.iteye.com/topic/260042
Android 调试桥(adb)是多种用途的工具,该工具可以帮助你你管理设备或模拟器 的状态。
可以通过下列几种方法加入adb:
在设备上运行shell命令
通过端口转发来管理模拟器或设备
从模拟器或设备上拷贝来或拷贝走文件
利用adb像手机发送消息,完成点击,移动,滑动等操作效果。
下面是控制手机电源键代码
@echo off adb shell sendevent /dev/input/event1 1 $((0x74)) 1 adb shell sendevent /dev/input/event1 0 0 0 adb shell sendevent /dev/input/event1 1 $((0x74)) 0 adb shell sendevent /dev/input/event1 0 0 0 pause & exit
其中 event1代表手机电源事件,1表示触发操作,0x74表示code,1表示value(1代表按下,0表示弹出)
下面是点击事件:
@echo off adb shell sendevent /dev/input/event0 3 $((0x39)) $((0x1a15)) adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x2)) adb shell sendevent /dev/input/event0 3 $((0x35)) $((0x1d7)) adb shell sendevent /dev/input/event0 3 $((0x36)) $((0x2c0)) adb shell sendevent /dev/input/event0 3 $((0x3a)) $((0x1b)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x39)) $((ffffffff)) adb shell sendevent /dev/input/event0 0 0 0 pause & exit
其中,利用了event0 3 $((0x3a))$((0x1b))表示点击,event0 3 $((0x35))$((0x1d7)),event0 3 $((0x36))$((0x2c0))表示x轴,y轴坐标。
下面表示移动事件:
@echo off adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x4)) adb shell sendevent /dev/input/event0 3 $((0x35)) 250 adb shell sendevent /dev/input/event0 3 $((0x36)) 670 adb shell sendevent /dev/input/event0 3 $((0x3a)) $((0x1f)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x21)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x21)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x24)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x26)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x28)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x35)) $((0x41)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x3a)) $((0x00)) adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x39)) $((ffffffff)) adb shell sendevent /dev/input/event0 0 0 0 pause & exit 或 @echo off adb shell sendevent /dev/input/event0 3 $((0x39)) $((0x1a7e)) adb shell sendevent /dev/input/event0 3 $((0x30)) $((0x2)) adb shell sendevent /dev/input/event0 3 $((0x35)) $((0xc1)) adb shell sendevent /dev/input/event0 3 $((0x36)) $((0x2c1)) adb shell sendevent /dev/input/event0 1 330 1---按下 adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x35)) $((0xc1)) adb shell sendevent /dev/input/event0 3 $((0x36)) $((0x201)) adb shell sendevent /dev/input/event0 3 $((0x35)) $((0x2d1)) adb shell sendevent /dev/input/event0 3 $((0x36)) $((0x201)) adb shell sendevent /dev/input/event0 1 330 0----弹出 adb shell sendevent /dev/input/event0 0 0 0 adb shell sendevent /dev/input/event0 3 $((0x39)) $((ffffffff)) adb shell sendevent /dev/input/event0 0 0 0 pause & exit
利用getevent,可以获取当前手机中的操作代码。

利用sendevent则可以通过adb发送事件。

监听到的真机上的事件代码:

问题汇总:
对于再刮一张的点击,能够很好的完成(注意如果利用touch,即330不够完美)。
对于滑动,可以看到,利用代码,可以绘制出一个直线,这是滑动屏幕的结果。

但在下面的红包的应用中,发现,滑动时,却不能很好的完成操作。其实在上面的滑动过程中,已经发现,对于滑动过程,利用代码,滑动非常缓慢,这也是下面图形不能刮开的一个原因。

由于刮的非常慢,所以会作出一个选择的操作,而不是一下滑动。而在有道笔记的应用中,view中没有提供选择,所以可以划出线条。
猜测关键:
1. 利用批处理,本身运行每个命令很慢(或有个默认时间)。
2. Adb发送消息,有一个默认的时间间隔。
3.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











According to news on August 17, the source @ibinguniverse posted on Weibo today, stating that the exact size of Apple iPhone 16 Pro Max is 6.88 inches, and the exact size of Galaxy S25 Ultra is 6.86 inches. Both can be regarded as 6.9 inches. Sources indicate that the Samsung Galaxy S25 Ultra has a narrower body and a wider screen than the S24 Ultra, with a horizontal screen-to-body ratio of 94.1%, while the S24 Ultra’s horizontal screen-to-body ratio is 91.5%. Fenye checked the relevant Weibo of the source. He also commented on the newly exposed photos of iPhone 16 Pro Max and believed that it was wrong to be close to a micro-curve. The phone is actually a straight screen + 2.5D glass.

Although Apple has been criticized for its lack of innovation in recent years, Apple has not always stood still. At least in terms of hardware design, with the support of the high unit prices of Apple products, its engineers can easily try some new technologies without having to consider too much cost issues. For example, iPad Pro, as Apple's favorite "display technology" test field, iPad Pro has been at the forefront of display technology for portable smart devices from miniLED in 2021 to tandem OLED in 2024. Although the iPad Pro is not the first portable smart device equipped with a miniLED screen (MSI released a miniLED laptop a year earlier than Apple), when you compare the parameters of the two, you will quickly realize that they are not the same

According to news on August 9, at the FMS2024 Summit, SK Hynix demonstrated its latest storage products, including UFS4.1 universal flash memory that has not yet officially released specifications. According to the official website of the JEDEC Solid State Technology Association, the latest UFS specification currently announced is UFS4.0 in August 2022. Its theoretical interface speed is as high as 46.4Gbps. It is expected that UFS4.1 will further improve the transmission rate. 1. Hynix demonstrated 512GB and 1TBUFS4.1 general-purpose flash memory products, based on 321-layer V91TbTLCNAND flash memory. SK Hynix also exhibited 3.2GbpsV92TbQLC and 3.6GbpsV9H1TbTLC particles. Hynix shows off V7-based

According to news on July 30, source Yogesh Brar posted a tweet on the X platform yesterday (July 29), sharing physical photos of Xiaomi POCOM6 Plus 5G mobile phone and POCO Buds X1 headphones. The official announcement of the two products will be released on August 1. Xiaomi POCOM6 Plus 5G mobile phone sources said that Xiaomi POCOM6 Plus 5G mobile phone will be equipped with a 6.8-inch LCD screen, equipped with Qualcomm Snapdragon 4Gen2AE processor, equipped with a 108-megapixel camera on the back, and a 5030mAh capacity battery. As previously reported, this phone is available in three colors: purple, black, and silver. It is roughly the same as the standard POCOM6 phone, but the LED flash ring is relatively more prominent. POCOB

According to news on August 19, Nubia has been adhering to the true full-screen design since the release of Z50 Ultra, and has been continuously exploring the field of proactive photography under high-pixel screens. Today, digital blogger Wisdom Pikachu broke the news that the Nubia Z70 Ultra, which will be released in the second half of this year, will debut with 1.5K under-screen camera technology, which is the highest-resolution UDC solution in the industry so far. It is reported that ZTE’s under-screen proactive solution has advanced to the sixth generation. The latest under-screen proactive solution is available in the Nubia Z60 Ultra and Red Magic 9S Pro series. The screen resolution is 2480x1116, which is between 1080P and 1.5K resolution. This time Nubia will break through the limitations of existing resolutions and set a new benchmark in the industry.

According to news on July 31, the source @ibinguniverse posted a tweet on the Equipped with 16GB of memory. Samsung mobile phone memory capacity update Samsung has launched 16GB memory on Galaxy S20 Ultra and Galaxy S21 Ultra mobile phones. Starting from Galaxy S22 Ultra, including the latest flagship Galaxy S24 Ultra mobile phone, the memory capacity of Samsung mobile phones is capped at 12GB. It is reported that the upcoming Samsung Galaxy S25 and Galaxy S25+ will use 12GB LPDD

According to news on July 31, technology media SamMobile published a blog post yesterday (July 30) and found battery information suitable for Samsung Galaxy S25 Ultra mobile phones on the SafetyKorea certification website. According to the public information, the battery models exposed this time are EB-BS938ABY and EB-BS938ABE. It is not yet clear what the difference between the two models is. fenye Samsung Galaxy S25 Ultra mobile phone will not use the dual battery solution of Galaxy Z Fold6 and Galaxy Z Flip 6 folding mobile phones, but will adopt a single battery design. It has been previously reported that Samsung will not upgrade and optimize the battery specifications of the Galaxy S25 Ultra mobile phone, and will still use

This website reported on August 2 that while loosening the "refund only" policy, Taobao will also launch an after-sales negotiation tool for all Taobao and Tmall merchants to meet the independent negotiation needs of merchants and consumers in after-sales scenarios. 1. Under normal circumstances, when a buyer initiates an after-sales service, the merchant can only choose to agree or refuse. For non-standard buyers’ after-sales demands (such as requesting a full refund after receiving the goods, being unable to provide valid vouchers for merchant liability refunds, etc.), merchants can only regard rejection as a communication channel with buyers, allowing them to For issues that need to be resolved through negotiation, rude rejection increases the platform's help-seeking rate and the platform's liability rate risk. According to reports, this tool is currently in internal testing for some merchants, and can automatically provide a variety of solutions for consumers to choose from according to the different needs of consumers in after-sales scenarios, such as sending comfort words to consumers.
