Vibrator is an Android-supplied vibrator that does not have a constructor to get objects through the Getsystemservice (Context.vibrator_service) method. However, when using this class, you need to add access permissions to the manifest file Android.permission.VIBRATE. In actual use can set the vibration period has been accessed timePackage Com.basillee.asus.demo;import Android.content.context;import android
Android alarm function, alarm bell sound, mobile phone starting to vibrate
To meet the company's project requirements, you must add the alarm function to the software,
Click the hand-drawn alarm icon to start shaking and send an alarm bell,
Layerlist, drawable, Vibrator, and soundpool are used.
Public class SosMainActivity extends BaseActivity {Private TextView sosTv1, sosTv2, sosTv3;Private int blueColor, whiteColor, transparent; Private
(cc_target_platform = = cc_platform_android) also can.Second, the Android sideAndroidmanifest.xml In addition to the vibration permissionEdit the Cocos2dxsound.java file under Org.cocos2dx.lib to add the following:/*** @param time */public void vibrate (long) {Vibrator V = (vibrator) Mcontext.getsystemservice (context.vibrator _service); V.vibrate (time);} /** * @param pattern Vibration Time Array eg:{500,
To implement the "Shake" function, it is actually very simple. It is to detect the mobile phone's gravity sensor. The specific implementation code is as follows:
1. Add operation permissions in AndroidManifest. xml
II. Implementation Code
[Java]Package com. xs. test;Import android. app. Activity;Import android. hardware. Sensor;Import android. hardware. SensorEvent;Import android. hardware. SensorEventListener;Import android. hardware. SensorManager;Import android. OS. Bundle;Import android. OS
There are several types of sensors:Direction Sensor: Sensor. TYPE_ORIENTATIONAcceleration (gravity) Sensor: Sensor. TYPE_ACCELEROMETERLight Sensor: Sensor. TYPE_LIGHTMagnetic Field Sensor: Sensor. TYPE_MAGNETIC_FIELDDistance (proximity) Sensor: Sensor. TYPE_PROXIMITYTemperature Sensor: Sensor. TYPE_TEMPERATURE
Here we use the acceleration sensor.
Package com. jamin. sensor;Import android. app. Activity;Import android. app. Service;Import android. hardware. Sensor;Import android. hardware. Sens
Android -- shake, android
To implement the "Shake" function, it is actually very simple. It is to detect the mobile phone's gravity sensor. The specific implementation code is as follows:
1. Add operation permissions in AndroidManifest. xml
II. Implementation Code
Package com. xs. test; import android. app. activity; import android. hardware. sensor; import android. hardware. sensorEvent; import android. hardware. sensorEventListener; import android. hardware. sensorManager; import android. OS.
call, GSM and so on.
Accessory parts: including sensor, backlight, vibrator, etc.
Specifically, there are the following:
[x] Display part: Includes framebuffer driver and Gralloc module.
[x] Input User Entry section: Includes event driver and Eventhub.
[x] Codec multimedia codec: Includes hardware codec drivers and codec plugins, such as OpenMAX.
[x] 3DAccelerator (3D Accelerator) Section: Includes hardware OpenGL driver
phones have these sensors, because the sensor needs money, so cheap phones will choose the most commonly used sensors to add, and some high-end models are basically the majority of sensors.Sensor use stepsThe steps for using an Android sensor can be broadly divided into three stages:1. Get sensor Management Service object Sensormanager.2. Create a sensor event listener class that must implement the Android.hardware.SensorEventListener interface.3. Use the Sensormanager.registerlistener method t
1. Download the joystick plugin (I uploaded one)
! [Write a picture description here] (https://img-blog.csdn.net/20180125231505826?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTNkXzIwMTcxMDMw/ Font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/southeast)
2. Create a Easytouch
Click "Creat" to create Easytouch
![ Here to write a picture description] (https://img-blog.csdn.net/20180125231611287?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uz
For RPG games on mobile platforms, we often use virtual joystick to control the walk and behavior of character roles. I believe we are no stranger to it. We tried easytouch2.5 before, it is found that the latest version of 3.1 is not easy to use. The version 2.5 does not do well in self-adaptation, and the latest version has solved this problem. Of course, unity also comes with the joystick, which is easy t
, right, bottom, and left. The pressure value of the first four buttons is between 11th and ~ 14th bytes, reading is always 0; the pressure values of the last four buttons are located in 15th ~ 18th bytes.
4th bytes are 8 buttons, from low to high, which are L2, R2, L1, R1, triangle, circle, cross, square. The pressure values of these 8 buttons are respectively located in 19th ~ 26th bytes.
The percentile of 5th bytes is the PS key. The pressure value of this key is at 27th bytes, And the readin
+ overlay Hardware Abstraction Layer
Camera (CAMERA)
Including the camera driver (usually v4l2) + camera Hardware Abstraction Layer
Phone)
Modem driver + RIL Library
GPS)
Including GPS Driver (usually serial port) + GPS Hardware Abstraction Layer
Wireless LAN (WiFi)
Including WLAN driver and Protocol + WiFi adaptation layer (android standard content)
Bluetooth part (blue tooth)
Including BT driver and Protocol + bt adaptation layer (android standard content)
Sensor)
Includes the sensor driver a
phone vibrator and display it with Toast. When calling the mobile phone vibration prompt, you need to add permissions for our app.
Next is our code section
Package com. example. shaketest; import android. app. activity; import android. content. context; import android. hardware. sensor; import android. hardware. sensorEvent; import android. hardware. sensorEventListener; import android. hardware. sensorManager; import android. OS. bundle; import a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.