Disable noise cancellation for microphone in Android (1.5)?

Noise filters in audio recording sources on Android vary greatly from device to device. It isn’t until Ice Cream Sandwich that any sort of definition was put into the device compatibility document defining a method for not having filtering. That method id to use the MediaRecorder.AudioSource.VOICE_RECOGNITION audio source. Before that it’s just choose a setting … Read more

Android: How to use AlarmManager

“Some sample code” is not that easy when it comes to AlarmManager. Here is a snippet showing the setup of AlarmManager: AlarmManager mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(context, OnAlarmReceiver.class); PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), PERIOD, pi); In this example, I am using setRepeating(). If you want a one-shot alarm, you would just use set(). Be … Read more

Creating an Android trial application that expires after a fixed time period

Currently most developers accomplish this using one of the following 3 techniques. The first approach is easily circumvented, the first time you run the app save the date/time to a file, database, or shared preferences and every time you run the app after that check to see if the trial period has ended. This is … Read more

How do I find out if the GPS of an Android device is enabled

Best way seems to be the following: final LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE ); if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { buildAlertMessageNoGps(); } private void buildAlertMessageNoGps() { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(“Your GPS seems to be disabled, do you want to enable it?”) .setCancelable(false) .setPositiveButton(“Yes”, new DialogInterface.OnClickListener() { public void onClick(@SuppressWarnings(“unused”) final … Read more