Last active
February 17, 2020 23:07
-
-
Save Venryx/ca673aa3a3b559bbb0f939f43fdbd9bc to your computer and use it in GitHub Desktop.
Trigger SonicBomb shakes from your app
This file contains hidden or 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
// Note: I'm not updating this anymore. For the latest version, see here: https://stackoverflow.com/a/60271550/2441655 | |
val patterns = arrayOf( | |
"!WLALALALALALALALA;", // default | |
"!WTRG0TRG0TRG0TRG;", // pulse | |
"!WPJ0FPV7S1J600;" // sos | |
// you can add your own patterns by mixing and matching the vibration components | |
); | |
// strength is between 0 and 100; pattern follows the format seen above | |
fun SonicBomb_Shake(strength: Int, pattern: String) { | |
Log.i(TAG, "SonicBomb_Shake @strength($strength) @pattern($pattern)") | |
val intent = Intent() | |
intent.action = "com.sonicalert.v2.intent.test_shake" | |
intent.putExtra("current strength m", strength) | |
intent.putExtra("current pattern", pattern) | |
intent.putExtra("current alarm audio", false) | |
MainActivity.instance!!.sendBroadcast(intent) | |
} | |
fun SonicBomb_StopShake() { | |
val intent = Intent() | |
intent.action = "com.sonicalert.v2.intent.alarm_dismiss" | |
MainActivity.instance!!.sendBroadcast(intent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment