This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nileshdeokar.simplevibratedemo; | |
import android.os.Build; | |
import android.os.VibrationEffect; | |
import android.os.Vibrator; | |
import android.support.annotation.RequiresApi; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.widget.Toast; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.VIBRATE"/> | |
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); | |
if (vibrator.hasVibrator()) { | |
vibrator.vibrate(500); // for 500 ms | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiresApi(api = Build.VERSION_CODES.O) | |
private void createOneShotVibrationUsingVibrationEffect() { | |
// 1000 : Vibrate for 1 sec | |
// VibrationEffect.DEFAULT_AMPLITUDE - would perform vibration at full strength | |
VibrationEffect effect = VibrationEffect.createOneShot(1000, VibrationEffect.DEFAULT_AMPLITUDE); | |
vibrator.vibrate(effect); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiresApi(api = Build.VERSION_CODES.O) | |
private void createWaveFormVibrationUsingVibrationEffectAndAmplitude() { | |
long[] mVibratePattern = new long[]{0, 400, 800, 600, 800, 800, 800, 1000}; | |
int[] mAmplitudes = new int[]{0, 255, 0, 255, 0, 255, 0, 255}; | |
// -1 : Play exactly once | |
if (vibrator.hasAmplitudeControl()) { | |
VibrationEffect effect = VibrationEffect.createWaveform(mVibratePattern, mAmplitudes, -1); | |
vibrator.vibrate(effect); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void customVibratePatternNoRepeat() { | |
// 0 : Start without a delay | |
// 400 : Vibrate for 400 milliseconds | |
// 200 : Pause for 200 milliseconds | |
// 400 : Vibrate for 400 milliseconds | |
long[] mVibratePattern = new long[]{0, 400, 200, 400}; | |
// -1 : Do not repeat this pattern | |
// pass 0 if you want to repeat this pattern from 0th index | |
vibrator.vibrate(mVibratePattern, -1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiresApi(api = Build.VERSION_CODES.O) | |
private void createOneShotVibrationUsingVibrationEffect() { | |
// 1000 : Vibrate for 1 sec | |
// VibrationEffect.DEFAULT_AMPLITUDE - would perform vibration at full strength | |
VibrationEffect effect = VibrationEffect.createOneShot(1000, VibrationEffect.DEFAULT_AMPLITUDE); | |
vibrator.vibrate(effect); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import subprocess | |
import re | |
#/ | |
# Created by @nieldeokar on 25/05/2018. | |
#/ | |
# 1. Python script which will copy database file of debuggable apps from the android device to your computer using ADB. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppUpdateCheckerUsingBitwiseShiftOperation { | |
private int mUpdateValue = 0; | |
private static final int UPDATE_AVAILABLE = 1; | |
private static final int UPDATE_COMPULSORY = 2; | |
public void setValue(int position){ | |
mUpdateValue = mUpdateValue | (1 << position); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nileshdeokar.healthapp; | |
public class GetAppUpdateAvailable { | |
private int updateValue = 0b0110; | |
private static final int UPDATE_AVAILABLE = 1; | |
private static final int UPDATE_COMPULSORY = 2; | |
public void getUpdateAvailable(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SetAppUpdateAvailable { | |
private int mUpdateValue = 0; | |
private static final int UPDATE_AVAILABLE = 1; | |
private static final int UPDATE_COMPULSORY = 2; | |
public void setUpdateAvailable(){ | |
mUpdateValue = mUpdateValue | (1 << UPDATE_AVAILABLE); | |
OlderNewer