Jun 30

Wifi

The WifiManager can be used to enable and disable wifi.

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(enabled);

GPS Location
we can use LocationManager to start up the GPS and get location updates.

LocationManager locator = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mLocationListener = new LocationListener() {
  public void onLocationChanged(Location location) {
    if (location != null) {
      location.getAltitude();
      location.getLatitude();
      location.getLongitude();
      location.getTime();
      location.getAccuracy();
      location.getSpeed();
      location.getProvider();
    }
  }

  public void onProviderDisabled(String provider) {
    // ...
  }

  public void onProviderEnabled(String provider) {
    // ...
  }

  public void onStatusChanged(String provider, int status, Bundle extras) {
    // ...
  }
};

// You need to specify a Criteria for picking the location data source.
// The criteria can include power requirements.
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);  // Faster, no GPS fix.
criteria.setAccuracy(Criteria.ACCURACY_FINE);  // More accurate, GPS fix.
// You can specify the time and distance between location updates.
// Both are useful for reducing power requirements.
mLocationManager.requestLocationUpdates(mLocationManager.getBestProvider(criteria, true),
    MIN_LOCATION_UPDATE_TIME, MIN_LOCATION_UPDATE_DISTANCE, mLocationListener,
    getMainLooper());

we can also get the phone’s last known location using the LocationManager. This is faster than setting up a LocationListener and waiting for a fix.

// Start with fine location.
Location l = locator.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (l == null) {
  // Fall back to coarse location.
  l = locator.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}

SMS
we can send SMS by using SmsManager.

SmsManager sm = SmsManager.getDefault();
String destination = "+919822390027";
String text = "Hello, jony!";
sm.sendTextMessage(destination, null, text, null, null);

Vibrate
we can vibrate the phone for a specified duration

(Vibrator) getSystemService(Context.VIBRATOR_SERVICE).vibrate(milliseconds);
Tagged with:
Apr 09

Google has confirmed in an update that the number of Android applications has almost doubled in only last three months. By mid-December, there have been 16,000 applications, now the number has jumped to over 30,000. The statistics refer to both free and paid apps. I think its may be due to the accelerated Android phone sales. which also increased the interest in apps development.

The number of android apps are increasing day by day. In march Android Market shot up by 68 percent, new data from AndroLib claimed. In February 5,532 new applications added to the store, the app count grew by a much larger 9,320 new applications in last month.

Android Statistics

Mar 31

The application I’m currently working requires that the user has the GPS active on phone. otherwise application is useless. The application needs the Geodata to function. This brought up the issue of, how do we know if the user actually has the GPS enabled on the phone? If they don’t, the application will still work, but all values are zero. to avoid this we need to check GPS status.

This can be done by using locationManager. it has isProviderEnabled() method by using that we can check GPS status.

Here is code snippet.

protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     LocationManager locManager = (LocationManager) getSystemService(LOCATION_SERVICE);

     if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
          createGpsDisabledAlert();
     }
}

private void createGpsDisabledAlert(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Your GPS is disabled! Would you like to enable it?")
     .setCancelable(false)
     .setPositiveButton("Enable GPS",
          new DialogInterface.OnClickListener(){
          public void onClick(DialogInterface dialog, int id){
               showGpsOptions();
          }
     });
     .setNegativeButton("Do nothing",
          new DialogInterface.OnClickListener(){
          public void onClick(DialogInterface dialog, int id){
               dialog.cancel();
          }
     });
AlertDialog alert = builder.create();
alert.show();
}

private void showGpsOptions(){
		Intent gpsOptionsIntent = new Intent(
				android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
		startActivity(gpsOptionsIntent);
}

And thats it! When the user starts the activity, if the GPS is off, the dialog will pop up asking them what they want to do. If the GPS is already on, nothing will happen.

Tagged with:
Mar 31

Currently I am working on GPS related project. and every day I am exploring new things. Now I realize that GPS is very interesting technology and we can make lot of useful things by using GPS.

The new thing today I learned is, finding distance between two points. Previously I was thinking that, it may be difficult but, thankfully there is a much simpler way to figure out distances between two points on a map: the distanceTo() method in the Location class. Using this handy little method, we can quickly find out the distance between two locations:

double distance;

Location locationA = new Location("point A");

locationA.setLatitude(latA);
locationA.setLongitude(lngA);

Location locationB = new Location("point B");

locationB.setLatitude(latB);
LocationB.setLongitude(lngB);

distance = locationA.distanceTo(locationB);

One thing to note is that the distanceTo() method returns the distance in meters, so you will need to do the appropriate calculations if you want your distances in other units.

Tagged with:
Oct 09

hay one more good news. Today we have launched Idioms on android, and within some hours we get very good response from android users.

Idioms

Idioms are the real guts of English. Idioms app provides learners with an opportunity to improve strategies for successfully utilizing native level expressions.
Idioms is a multiple choice quiz system for English which provides 700 common idiomatic expressions.
Idioms was designed to provide a method of acquiring idiomatic expressions and a context for using them in everyday English conversation.

FEATURE LIST:

• Over 700 multiple-choice questions.
• Choose number of questions you would like in each test.
• Shows test results in HTML format with explanation for each question.
• E-mail yourself the test results and track your progress.
• Cool sound effects. (You can turn them off if desired.)
• Special algorithm that randomizes questions every time you take a test.

Tagged with:
Oct 07

Most famous iPhone application now on Android. Yes Grammar Up now on Android.

Grammar Up

Read more about what Grammar Up is and how it helps to master your English grammar.

Grammar Up is a multiple choice quiz system for English which provides over 1800 questions across 20 grammar categories.
Grammar Up was designed to replicate questions with a business focus commonly found in the popular TOEIC (TM) English proficiency test.
Grammar Up can help learners to improve their grammar, word selection and vocabulary.

Tagged with:
preload preload preload