Pages

Showing posts with label art. Show all posts
Showing posts with label art. Show all posts

Tuesday, May 10, 2016

Android Developers Backstage Episode 11 ART pART 2 Trash Talk

In this continuation of the previous gripping and suspenseful episode known as Episode 10, Tor and Chet hear more from Anwar Ghuloum from the Android Runtime team. This time is all trash-talk. Tune in to hear more about garbage collection and how allocation and collection performance is much faster with ART (and, more interestingly, why its faster).

Subscribe to the podcast feed or download the audio file directly.

ARTicles:
Introducing ART: http://source.android.com/devices/tech/dalvik/art.html
Verifying App Behavior: http://developer.android.com/guide/practices/verifying-apps-art.html

Video:
The ART Runtime: https://www.youtube.com/watch?v=EBlTzQsUoOw

Other Resources:
Systrace: http://developer.android.com/tools/help/systrace.html

Tor: google.com/+TorNorbye
Chet: google.com/+ChetHaase
Read More..

Wednesday, March 30, 2016

Android Developers Backstage Episode 10 ART pART 1

Tor and Chet may not know ART, but they know what they like. In this episode, the first in a two-pART series, they talk with Anwar Ghuloum from the ART, or Android Runtime team. ART is the new runtime for Android, which came online in the KitKat release as an alternative to Dalvik. Now ART is not only enabled by default: it’s the only runtime. We’ll talk about what it is, how it works, why it’s better, and the future and very meaning of ART in modern society.

Subscribe to the podcast feed or download the audio file directly.

ARTicles:
Introducing ART: http://source.android.com/devices/tech/dalvik/art.html
Verifying App Behavior: http://developer.android.com/guide/practices/verifying-apps-art.html

Google I/O 2014 Session:
The ART Runtime: https://www.youtube.com/watch?v=EBlTzQsUoOw

Other Resources:
Systrace: http://developer.android.com/tools/help/systrace.html

Tor: google.com/+TorNorbye
Chet: google.com/+ChetHaase
Read More..

Wednesday, March 2, 2016

Location Manager Android Developer Tutorial Part 15


Location-based service is another key functionality that gets used by mobile applications. IT is often combined with maps to give a good user experience. We have already see how to use the external Google Maps API in tutorial Part 14. Here I will build upon the same to show how changes in location can be displayed on the map.
The location services are provided in the android.location package.


In order to use location services, our activity needs to implement the LocationManager Interface.
What does a LocationManager provide?


It is through this interface that an application can access the system’s location services. These services basically allow the application to obtain periodic updates of the device’s geographical location. It also helps in firing an application specific intent when the device comes within the proximity of a specified location.
Since in my example I want to simulate a location change and make my activity respond to the same, I am implementing this interface.


In order to make it an effective application, I have shown my location (hard-coded) on the google map. Then, I have used the location manager to handle any change in the location. The change in location needs to be simulated on the emulator by connecting through telnet. How to simulate location change is given at the end of this tutorial.


Now, dive into the code.


NOTE: I am adding the LocationManager implementation to the same MapActivity class created in the earlier tutorial (Part 14) and hence will not be explaining anything related to the maps API here.


Step 1: Obtain the LocationManager instance:


LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);


After getting the location manager, I am setting default GPS provider and asking to be notified if the location changes by more than 500 meters from the current location, the frequency of updation being 1 sec.


Step 2:Override the onLocationChanged() method in order to respond to changes in location.


      public voidonLocationChanged(Location location) {
            if (location != null) {
                  double lat = location.getLatitude();
                  double lng = location.getLongitude();
                  String currentLocation = "The location is changed to Lat: " + lat + " Lng: " + lng;
                  myLoc.setText(currentLocation);
                  geoPoint = new GeoPoint((int) lat * 1000000, (int) lng * 1000000);
                  myMC.animateTo(geoPoint);
            }
      }


This method gets invoked when we change the location through the telnet connection to the emulator as described at the end of the tutorial. Based on the latitude and the longitude settings sent, the GeoPoint is changed to display the new location.


That is it. I have not overridden any of the other methods provided by the locationManager. Complete code is downloadable here.



How to simulate location change in the emulator?
Start the Emulator from eclipse
Start a command prompt
Start telnet
Then, type, o localhost 5554
This connects the telnet client to the android emulator (assuming emulator is running locally listening on port 5554. Else this connection fails)
Now type
geo fix 79.000000 13.000000 (or your latitude and longitude)
This sends the location change signal to the emulator.

Read More..

Saturday, February 20, 2016

Updating the past tutorials to Android SDK 2 0

Hi Friends,

It has been a couple of weeks since Android SDK 2.0 has been released. Since I have got caught up in many other demanding projects, I have not been able to find any time to update my tutorials sample code uploaded so far to be compatible to 2.0.
It would be wonderful if, as and when you try my tutorials, you can update / post your comments on deprecated APIs or newer APIs that need to be used.

Thanks.

Hi, I have written a few steps about upgrading to SDK 2.1 at http://saigeethamn.blogspot.com/2010/03/basic-steps-for-upgrading-source-code.html
Read More..