Short and frequent ringtones apply:
soundPool = new SoundPool(10, AudioManager.STREAM_SYSTEM, 5); soundPool.load(this, R.raw.qud, 1);
transfer:
soundPool.play(1, 1, 1, 0, 0, 1);
It should be noted that this method cannot be called directly, it needs to be loaded in advance, otherwise no sound will be made.
() For example, run the first paragraph in oncreate, and write play method in onclick method)
shock:
/* * If you want to set the vibration size, you can set it by changing the pattern. If the opening time is too short, the vibration effect may not be felt * */ vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); long [] pattern = {800, 500, 400, 300}; // stop open stop open vibrator.vibrate(pattern,0); //Repeat the above pattern twice if you only want to vibrate once, set the index to -1 and parameter 2 is to repeat from the specified subscript