Last active
July 24, 2024 13:35
-
-
Save bendenoz/d9832f24caa6c826f1c4 to your computer and use it in GitHub Desktop.
Revisions
-
bendenoz revised this gist
Oct 12, 2014 . 1 changed file with 53 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ import android.media.MediaPlayer; import android.media.AudioManager; import android.util.Log; import java.io.IOException; public class Beep { /** * Command-line entry point. * * @param args The command-line arguments */ public static void main(String[] args) { (new Beep()).run(args); } private void run(String[] a) { MediaPlayer mp = new MediaPlayer(); try { mp.setDataSource(a[0]); mp.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); mp.setVolume(1f,1f); mp.prepare(); mp.start(); } catch (IOException e) { Log.w("Beep", "IOException", e); } System.out.print("Playing " + mp.getDuration() + "ms"); int i = 0; while(mp.isPlaying() && i < 20) { System.out.print("."); i++; try { Thread.sleep(1000); } catch(InterruptedException e) { Log.w("Beep", "IOException", e); } } System.out.println(); mp.stop(); mp.release(); System.out.println("Stopped."); } } -
bendenoz created this gist
Oct 12, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ export CLASSPATH=./Beep.dex app_process /system/bin Beep /system/media/audio/ringtones/Beep-beep.ogg