BEGINNER’S GUIDE TO MOBILE APP DEVELOPMENT IN ANDRIOD STUDIO
if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); Toast.makeText(getApplicationContext(), "READY TO SEND!!!", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), "NOT READY YET...", Toast.LENGTH_LONG).show(); } } @Override public void onStatusChanged(String s, int i, Bundle bundle) { } @Override public void onProviderEnabled(String s) { Toast.makeText(getApplicationContext(), "GPS Enabled!", Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String s) { Toast.makeText(getApplicationContext(), "Please enable GPS!", Toast.LENGTH_LONG).show(); } } } Code 10.11 (cont‟d from the previous pages)
10.4. Building and Running the App Since this app uses SMS functionality, it needs a GSM connection therefore it cannot be simulated in an emulator. Please connect a real Android device to your computer and select it for running this app after hitting the Run button in Android Studio as follows:
198