sábado, 8 de outubro de 2011

Todos poderão apostar na Mega Sena via internet a partir de março

Todos poderão apostar na Mega Sena via internet a partir de março:

Eu já imaginei o que faria se de repente ganhasse alguns milhões de reais na minha conta. Quem nunca? Mas, pra isso acontecer, ou você constrói uma carreira lucrativa, ou herda uma fortuna, ou ganha na Mega Sena. Bem, a última alternativa ficará mais acessível: Fábio Ferreira Cleto, da Caixa Econômica Federal, diz que o banco está em estudos avançados para lançar a Mega Sena via internet, “com expectativa de lançamento marcado para março de 2012″.

A Mega Sena online já existe, mas só pra quem tem conta na Caixa – a ideia é ampliar o serviço a todos. Cleto explica que o apostador poderá fazer as apostas no site da Caixa, e “vai conseguir imprimir e ter lá registrados todos os seus boletos de aposta”.

Mas como as apostas serão pagas? Segundo Cleto, será criada uma “carteira eletrônica” na qual você poderá colocar dinheiro e usá-lo para pagar suas apostas. Ele não deu mais detalhes sobre como este sistema vai funcionar, mas disse que esperam anunciá-la “em março de 2012″.

Enquanto não sabemos como gastar na Mega Sena online, conte-me: o que você faria se ganhasse? [Agência Brasil via IDG]

Mega Sena com os números da Iniciativa Dharma por FoXMuLD3R/Flickr



sexta-feira, 7 de outubro de 2011

Dark Energy FAQ

Dark Energy FAQ:

In honor of the Nobel Prize, here are some questions that are frequently asked about dark energy, or should be.


What is dark energy?


It’s what makes the universe accelerate, if indeed there is a “thing” that does that. (See below.)


So I guess I should be asking… what does it mean to say the universe is “accelerating”?


First, the universe is expanding: as shown by Hubble, distant galaxies are moving away from us with velocities that are roughly proportional to their distance. “Acceleration” means that if you measure the velocity of one such galaxy, and come back a billion years later and measure it again, the recession velocity will be larger. Galaxies are moving away from us at an accelerating rate.


But that’s so down-to-Earth and concrete. Isn’t there a more abstract and scientific-sounding way of putting it?


The relative distance between far-flung galaxies can be summed up in a single quantity called the “scale factor,” often written a(t) or R(t). The scale factor is basically the “size” of the universe, although it’s not really the size because the universe might be infinitely big — more accurately, it’s the relative size of space from moment to moment. The expansion of the universe is the fact that the scale factor is increasing with time. The acceleration of the universe is the fact that it’s increasing at an increasing rate — the second derivative is positive, in calculus-speak.


Does that mean the Hubble constant, which measures the expansion rate, is increasing?


No. The Hubble “constant” (or Hubble “parameter,” if you want to acknowledge that it changes with time) characterizes the expansion rate, but it’s not simply the derivative of the scale factor: it’s the derivative divided by the scale factor itself. Why? Because then it’s a physically measurable quantity, not something we can change by switching conventions. The Hubble constant is basically the answer to the question “how quickly does the scale factor of the universe expand by some multiplicative factor?”


If the universe is decelerating, the Hubble constant is decreasing. If the Hubble constant is increasing, the universe is accelerating. But there’s an intermediate regime in which the universe is accelerating but the Hubble constant is decreasing — and that’s exactly where we think we are. The velocity of individual galaxies is increasing, but it takes longer and longer for the universe to double in size.


Said yet another way: Hubble’s Law relates the velocity v of a galaxy to its distance d via v = H d. The velocity can increase even if the Hubble parameter is decreasing, as long as it’s decreasing more slowly than the distance is increasing.


Did the astronomers really wait a billion years and measure the velocity of galaxies again?


No. You measure the velocity of galaxies that are very far away. Because light travels at a fixed speed (one light year per year), you are looking into the past. Reconstructing the history of how the velocities were different in the past reveals that the universe is accelerating.


How do you measure the distance to galaxies so far away?


It’s not easy. The most robust method is to use a “standard candle” — some object that is bright enough to see from great distance, and whose intrinsic brightness is known ahead of time. Then you can figure out the distance simply by measuring how bright it actually looks: dimmer = further away.


Sadly, there are no standard candles.


Then what did they do?


Fortunately we have the next best thing: standardizable candles. A specific type of supernova, Type Ia, are very bright and approximately-but-not-quite the same brightness. Happily, in the 1990′s Mark Phillips discovered a remarkable relationship between intrinsic brightness and the length of time it takes for a supernova to decline after reaching peak brightness. Therefore, if we measure the brightness as it declines over time, we can correct for this difference, constructing a universal measure of brightness that can be used to determine distances.


Why are Type Ia supernovae standardizable candles?


We’re not completely sure — mostly it’s an empirical relationship. But we have a good idea: we think that SNIa are white dwarf stars that have been accreting matter from outside until they hit the Chandrasekhar Limit and explode. Since that limit is basically the same number everywhere in the universe, it’s not completely surprising that the supernovae have similar brightnesses. The deviations are presumably due to differences in composition.


But how do you know when a supernova is going to happen?


You don’t. They are rare, maybe once per century in a typical galaxy. So what you do is look at many, many galaxies with wide-field cameras. In particular you compare an image of the sky taken at one moment to another taken a few weeks later — “a few weeks” being roughly the time between new Moons (when the sky is darkest), and coincidentally about the time it takes a supernova to flare up in brightness. Then you use computers to compare the images and look for new bright spots. Then you go back and examine those bright spots closely to try to check whether they are indeed Type Ia supernovae. Obviously this is very hard and wouldn’t even be conceivable if it weren’t for a number of relatively recent technological advances — CCD cameras as well as giant telescopes. These days we can go out and be confident that we’ll harvest supernovae by the dozens — but when Perlmutter and his group started out, that was very far from obvious.


And what did they find when they did this?


Most (almost all) astronomers expected them to find that the universe was decelerating — galaxies pull on each other with their gravitational fields, which should slow the whole thing down. (Actually many astronomers just thought they would fail completely, but that’s another story.) But what they actually found was that the distant supernovae were dimmer than expected — a sign that they are farther away than we predicted, which means the universe has been accelerating.


Why did cosmologists accept this result so quickly?


Even before the 1998 announcements, it was clear that something funny was going on with the universe. There seemed to be evidence that the age of the universe was younger than the age of its oldest stars. There wasn’t as much total matter as theorists predicted. And there was less structure on large scales than people expected. The discovery of dark energy solved all of these problems at once. It made everything snap into place. So people were still rightfully cautious, but once this one startling observation was made, the universe suddenly made a lot more sense.


How do we know the supernovae not dimmer because something is obscuring them, or just because things were different in the far past?


That’s the right question to ask, and one reason the two supernova teams worked so hard on their analysis. You can never be 100% sure, but you can gain more and more confidence. For example, astronomers have long known that obscuring material tends to scatter blue light more easily than red, leading to “reddening” of stars that sit behind clouds of gas and dust. You can look for reddening, and in the case of these supernovae it doesn’t appear to be important. More crucially, by now we have a lot of independent lines of evidence that reach the same conclusion, so it looks like the original supernova results were solid.


There’s really independent evidence for dark energy?


Oh yes. One simple argument is “subtraction”: the cosmic microwave background measures the total amount of energy (including matter) in the universe. Local measures of galaxies and clusters measure the total amount of matter. The latter turns out to be about 27% of the former, leaving 73% or so in the form of some invisible stuff that is not matter: “dark energy.” That’s the right amount to explain the acceleration of the universe. Other lines of evidence come from baryon acoustic oscillations (ripples in large-scale structure whose size helps measure the expansion history of the universe) and the evolution of structure as the universe expands.


Okay, so: what is dark energy?


Glad you asked! Dark energy has three crucial properties. First, it’s dark: we don’t see it, and as far as we can observe it doesn’t interact with matter at all. (Maybe it does, but beneath our ability to currently detect.) Second, it’s smoothly distributed: it doesn’t fall into galaxies and clusters, or we would have found it by studying the dynamics of those objects. Third, it’s persistent: the density of dark energy (amount of energy per cubic light-year) remains approximately constant as the universe expands. It doesn’t dilute away like matter does.


These last two properties (smooth and persistent) are why we call it “energy” rather than “matter.” Dark energy doesn’t seem to act like particles, which have local dynamics and dilute away as the universe expands. Dark energy is something else.


That’s a nice general story. What might dark energy specifically be?


The leading candidate is the simplest one: “vacuum energy,” or the “cosmological constant.” Since we know that dark energy is pretty smooth and fairly persistent, the first guess is that it’s perfectly smooth and exactly persistent. That’s vacuum energy: a fixed amount of energy attached to every tiny region of space, unchanging from place to place or time to time. About one hundred-millionth of an erg per cubic centimeter, if you want to know the numbers.


Is vacuum energy really the same as the cosmological constant?


Yes. Don’t believe claims to the contrary. When Einstein first invented the idea, he didn’t think of it as “energy,” he thought of it as a modification of the way spacetime curvature interacted with energy. But it turns out to be precisely the same thing. (If someone doesn’t want to believe this, ask them how they would observationally distinguish the two.)


Doesn’t vacuum energy come from quantum fluctuations?


Not exactly. There are many different things that can contribute to the energy of empty space, and some of them are completely classical (nothing to do with quantum fluctuations). But in addition to whatever classical contribution the vacuum energy has, there are also quantum fluctuations on top of that. These fluctuation are very large, and that leads to the cosmological constant problem.


What is the cosmological constant problem?


If all we knew was classical mechanics, the cosmological constant would just be a number — there’s no reason for it to be big or small, positive or negative. We would just measure it and be done.


But the world isn’t classical, it’s quantum. In quantum field theory we expect that classical quantities receive “quantum corrections.” In the case of the vacuum energy, these corrections come in the form of the energy of virtual particles fluctuating in the vacuum of empty space.


We can add up the amount of energy we expect in these vacuum fluctuations, and the answer is: an infinite amount. That’s obviously wrong, but we suspect that we’re overcounting. In particular, that rough calculation includes fluctuations at all sizes, including wavelengths smaller than the Planck distance at which spacetime probably loses its conceptual validity. If instead we only include wavelengths that are at the Planck length or longer, we get a specific estimate for the value of the cosmological constant.


The answer is: 10120 times what we actually observe. That discrepancy is the cosmological constant problem.


Why is the cosmological constant so small?


Nobody knows. Before the supernovae came along, many physicists assumed there was some secret symmetry or dynamical mechanism that set the cosmological constant to precisely zero, since we certainly knew it was much smaller than our estimates would indicate. Now we are faced with both explaining why it’s small, and why it’s not quite zero. And for good measure: the coincidence problem, which is why the dark energy density is the same order of magnitude as the matter density.


Here’s how bad things are: right now, the best theoretical explanation for the value of the cosmological constant is the anthropic principle. If we live in a multiverse, where different regions have very different values of the vacuum energy, one can plausibly argue that life can only exist (to make observations and win Nobel Prizes) in regions where the vacuum energy is much smaller than the estimate. If it were larger and positive, galaxies (and even atoms) would be ripped apart; if it were larger and negative, the universe would quickly recollapse. Indeed, we can roughly estimate what typical observers should measure in such a situation; the answer is pretty close to the observed value. Steven Weinberg actually made this prediction in 1988, long before the acceleration of the universe was discovered. He didn’t push it too hard, though; more like “if this is how things work out, this is what we should expect to see…” There are many problems with this calculation, especially when you start talking about “typical observers,” even if you’re willing to believe there might be a multiverse. (I’m very happy to contemplate the multiverse, but much more skeptical that we can currently make a reasonable prediction for observable quantities within that framework.)


What we would really like is a simple formula that predicts the cosmological constant once and for all as a function of other measured constants of nature. We don’t have that yet, but we’re trying. Proposed scenarios make use of quantum gravity, extra dimensions, wormholes, supersymmetry, nonlocality, and other interesting but speculative ideas. Nothing has really caught on as yet.


Has the course of progress in string theory ever been affected by an experimental result?


Yes: the acceleration of the universe. Previously, string theorists (like everyone else) assumed that the right thing to do was to explain a universe with zero vacuum energy. Once there was a real chance that the vacuum energy is not zero, they asked whether that was easy to accommodate within string theory. The answer is: it’s not that hard. The problem is that if you can find one solution, you can find an absurdly large number of solutions. That’s the string theory landscape, which seems to kill the hopes for one unique solution that would explain the real world. That would have been nice, but science has to take what nature has to offer.


What’s the coincidence problem?


Matter dilutes away as the universe expands, while the dark energy density remains more or less constant. Therefore, the relative density of dark energy and matter changes considerably over time. In the past, there was a lot more matter (and radiation); in the future, dark energy will completely dominate. But today, they are approximately equal, by cosmological standards. (When two numbers could differ by a factor of 10100 or much more, a factor of three or so counts as “equal.”) Why are we so lucky to be born at a time when dark energy is large enough to be discoverable, but small enough that it’s a Nobel-worthy effort to do so? Either this is just a coincidence (which might be true), or there is something special about the epoch in which we live. That’s one of the reasons people are willing to take anthropic arguments seriously. We’re talking about a preposterous universe here.


If the dark energy has a constant density, but space expands, doesn’t that mean energy isn’t conserved?


Yes. That’s fine.


What’s the difference between “dark energy” and “vacuum energy”?


“Dark energy” is the general phenomenon of smooth, persistent stuff that makes the universe accelerate; “vacuum energy” is a specific candidate for dark energy, namely one that is absolutely smooth and utterly constant.


So there are other candidates for dark energy?


Yes. All you need is something that is pretty darn smooth and persistent. It turns out that most things like to dilute away, so finding persistent energy sources isn’t that easy. The simplest and best idea is quintessence, which is just a scalar field that fills the universe and changes very slowly as time passes.


Is the quintessence idea very natural?


Not really. An original hope was that, by considering something dynamical and changing rather than a plain fixed constant energy, you could come up with some clever explanation for why the dark energy was so small, and maybe even explain the coincidence problem. Neither of those hopes has really panned out.


Instead, you’ve added new problems. According to quantum field theory, scalar fields like to be heavy; but to be quintessence, a scalar field would have to be enormously light, maybe 10-30 times the mass of the lightest neutrino. (But not zero!) That’s one new problem you’ve introduced, and another is that a light scalar field should interact with ordinary matter. Even if that interaction is pretty feeble, it should still be large enough to detect — and it hasn’t been detected. Of course, that’s an opportunity as well as a problem — maybe better experiments will actually find a “quintessence force,” and we’ll understand dark energy once and for all.


How else can we test the quintessence idea?


The most direct way is to do the supernova thing again, but do it better. More generally: map the expansion of the universe so precisely that we can tell whether the density of dark energy is changing with time. This is generally cast as an attempt to measure the dark energy equation-of-state parameter w. If w is exactly minus one, the dark energy is exactly constant — vacuum energy. If w is slightly greater than -1, the energy density is gradually declining; if it’s slightly less (e.g. -1.1), the dark energy density is actually growing with time. That’s dangerous for all sorts of theoretical reasons, but we should keep our eyes peeled.


What is w?


It’s called the “equation-of-state parameter” because it relates the pressure p of dark energy to its energy density ρ, via w = p/ρ. Of course nobody measures the pressure of dark energy, so it’s a slightly silly definition, but it’s an accident of history. What really matters is how the dark energy evolves with time, but in general relativity that’s directly related to the equation-of-state parameter.


Does that mean that dark energy has negative pressure?


Yes indeed. Negative pressure is what happens when a substance pulls rather than pushes — like an over-extended spring that pulls on either end. It’s often called “tension.” This is why I advocated smooth tension as a better name than “dark energy,” but I came in too late.


Why does dark energy make the universe accelerate?


Because it’s persistent. Einstein says that energy causes spacetime to curve. In the case of the universe, that curvature comes in two forms: the curvature of space itself (as opposed to spacetime), and the expansion of the universe. We’ve measured the curvature of space, and it’s essentially zero. So the persistent energy leads to a persistent expansion rate. In particular, the Hubble parameter is close to constant, and if you remember Hubble’s Law from way up top (v = H d) you’ll realize that if H is approximately constant, v will be increasing because the distance is increasing. Thus: acceleration.


Is negative pressure is like tension, why doesn’t it pull things together rather than pushing them apart?


Sometimes you will hear something along the lines of “dark energy makes the universe accelerate because it has negative pressure.” This is strictly speaking true, but a bit ass-backwards; it gives the illusion of understanding rather than actual understanding. You are told “the force of gravity depends on the density plus three times the pressure, so if the pressure is equal and opposite to the density, gravity is repulsive.” Seems sensible, except that nobody will explain to you why gravity depends on the density plus three times the pressure. And it’s not really the “force of gravity” that depends on that; it’s the local expansion of space.


The “why doesn’t tension pull things together?” question is a perfectly valid one. The answer is: because dark energy doesn’t actually push or pull on anything. It doesn’t interact directly with ordinary matter, for one thing; for another, it’s equally distributed through space, so any pulling it did from one direction would be exactly balanced by an opposite pull from the other. It’s the indirect effect of dark energy, through gravity rather than through direct interaction, that makes the universe accelerate.


The real reason dark energy causes the universe to accelerate is because it’s persistent.


Is dark energy like antigravity?


No. Dark energy is not “antigravity,” it’s just gravity. Imagine a world with zero dark energy, except for two blobs full of dark energy. Those two blobs will not repel each other, they will attract. But inside those blobs, the dark energy will push space to expand. That’s just the miracle of non-Euclidean geometry.


Is it a new repulsive force?


No. It’s just a new (or at least different) kind of source for an old force — gravity. No new forces of nature are involved.


What’s the difference between dark energy and dark matter?


Completely different. Dark matter is some kind of particle, just one we haven’t discovered yet. We know it’s there because we’ve observed its gravitational influence in a variety of settings (galaxies, clusters, large-scale structure, microwave background radiation). It’s about 23% of the universe. But it’s basically good old-fashioned “matter,” just matter that we can’t directly detect (yet). It clusters under the influence of gravity, and dilutes away as the universe expands. Dark energy, meanwhile, doesn’t cluster, nor does it dilute away. It’s not made of particles, it’s some different kind of thing entirely.


Is it possible that there is no dark energy, just a modification of gravity on cosmological scales?


It’s possible, sure. There are at least two popular approaches to this idea: f(R) gravity , which Mark and I helped develop, and DGP gravity, by Dvali, Gabadadze, and Porati. The former is a directly phenomenological approach where you simply change the Einstein field equation by messing with the action in four dimensions, while the latter uses extra dimensions that only become visible at large distances. Both models face problems — not necessarily insurmountable, but serious — with new degrees of freedom and attendant instabilities.


Modified gravity is certainly worth taking seriously (but I would say that). Still, like quintessence, it raises more problems than it solves, at least at the moment. My personal likelihoods: cosmological constant = 0.9, dynamical dark energy = 0.09, modified gravity = 0.01. Feel free to disagree.


What does dark energy imply about the future of the universe?


That depends on what the dark energy is. If it’s a true cosmological constant that lasts forever, the universe will continue to expand, cool off, and empty out. Eventually there will be nothing left but essentially empty space.


The cosmological constant could be constant at the moment, but temporary; that is, there could be a future phase transition in which the vacuum energy decreases. Then the universe could conceivably recollapse.


If the dark energy is dynamical, any possibility is still open. If it’s dynamical and increasing (w less than -1 and staying that way), we could even get a Big Rip.


What’s next?


We would love to understand dark energy (or modified gravity) through better cosmological observations. That means measuring the equation-of-state parameter, as well as improving observations of gravity in galaxies and clusters to compare with different models. Fortunately, while the U.S. is gradually retreating from ambitious new science projects, the European Space Agency is moving forward with a satellite to measure dark energy. There are a number of ongoing ground-based efforts, of course, and the Large Synoptic Survey Telescope should do a great job once it goes online.


But the answer might be boring — the dark energy is just a simple cosmological constant. That’s just one number; what are you going to do about it? In that case we need better theories, obviously, but also input from less direct empirical sources — particle accelerators, fifth-force searches, tests of gravity, anything that would give some insight into how spacetime and quantum field theory fit together at a basic level.


The great thing about science is that the answers aren’t in the back of the book; we have to solve the problems ourselves. This is a big one.

Android Essentials: Making Sense of Android Versioning

Android Essentials: Making Sense of Android Versioning:
This entry is part 9 of 9 in the series Android Essentials

Cupcake, Donut, Éclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich… Perhaps you’ve heard Android developers talking about these platform code-names and wondered how to keep track of all these different versions of the Android platform. In this tutorial, you’ll learn everything you need to know about Android platform versioning.


The Android platform is constantly evolving. Developers who want to write Android applications for specific devices need to be aware of the platform versions they need to support, and how to achieve this.


How Android Versioning Works


Android platform versions are labeled in a number of ways: by version number, by code-name, and by API level.



  • The version number is a traditional, incremental version associated with the progress of the platform. For example, the first official Android release was Android 1.0. The next minor release was Android 1.1, and so on. Android releases vary in importance. A very minor release may receive an increment of a tenth or even a hundredth. A major release usually increments by a whole number. E.g. 2.0.

  • The code-name is a friendly name associated with a substantive update to the platform and corresponds to a specific Android version or range of versions. The first two releases of the Android platform did not have official (and external) code-names, but each important subsequent version has, regardless of whether it was a whole numbered version or not. The code-names are alphabetical and tied to sweets like Cupcakes, Donuts, and, most recently, Ice Cream Sandwiches. Minor releases or updates do not receive codenames, but retain the prior code-name and are labeled with MR. For example, Honeycomb (Android 3.0) was released in Feb. 2011, Honeycomb MR1 (Android 3.1) was released in May of the same year.

  • The API Level is a number that identifies which Android SDK revision (set of APIs) is compatible with a specific Android platform version. As the Android platform has matured, so has the Android SDK. New classes, methods, and features have been added to the platform over time. Each new class or method specifies the API Level in which it was introduced. These features are only accessible to applications that target devices that run a platform version that matches the API Level or higher.



  • Android 1.0 corresponds to API Level 1. This first official version of the Android platform did not have a code-name.

  • Android 1.1 corresponds to API Level 2. This second official version of the Android platform did not have a code-name.

  • Android 1.5 corresponds to API Level 3. This version of the Android platform was code-named Cupcake.

  • Android 1.6 corresponds to API Level 4. This version of the Android platform was code-named Donut.

  • Android 2.0 corresponds to API Level 5. This version of the Android platform was code-named Eclair.

  • Android 2.0.1 corresponds to API Level 6. This version of the Android platform was code-named Eclair _0_1.

  • Android 2.1.X versions correspond to API Level 7. These versions of the Android platform were code-named Eclair MR1.

  • Android 2.2.X versions correspond to API Level 8. These versions of the Android platform were code-named Froyo.

  • Android 2.3, 2.3.1 and 2.3.2 correspond to API Level 9. These versions of the Android platform were code-named Gingerbread.

  • Android 2.3.3 and 2.3.4 correspond to API Level 10. These versions of the Android platform were code-named Gingerbread MR1.

  • Android 3.0.X versions correspond to API Level 11. These versions of the Android platform were code-named Honeycomb.

  • Android 3.1.X versions correspond to API Level 12. These versions of the Android platform were code-named Honeycomb MR1.

  • Android 3.2.X versions correspond to API Level 13. These versions of the Android platform were code-named Honeycomb MR2.

  • Android 4.0 (anticipated Fall 2011) will likely correspond to API Level 14. The next version of the Android platform has been code-named Ice Cream Sandwich.


Not only do Android versions have names, versions, and API Levels… they also have logos!





For more information on platform versions, API Levels, and code-names, see the Android API Levels appendix in the Android SDK documentation.


Specifying the Android Application SDK Target Range


Android applications are compiled against a specific version of the Android SDK, as determined in the project settings when the project is created or updated. The platform target is also defined in the Android manifest file associated with a given application, using the API Level value.

Developers can use the tag to specify the Android platform versions supported by the application. This tag has three attributes:



  • android:minSdkVersion: The minimum Android platform version supported by the application, specified as an API Level. While the application is not compiled against this version of the Android SDK, developers should use this attribute to indicate compatibility. If this value is not set, the assumption is that the application is compatible with all versions of the Android SDK. Using this attribute is highly recommended.

  • android:targetSdkVersion: The target Android platform version supported by the application, specified as an API Level. This is usually the version of the Android SDK compiled against and used to indicate the version the developer primarily tested and designed for. Using this attribute is highly recommended.

  • android:maxSdkVersion: The maximum Android platform version supported by the application, specified as an API Level. Using this attribute is not recommended for a variety of reasons and is being phased out.


Generally speaking, most developers will want to support as many different devices as possible with a single application package file. This means setting the broadest range of API Levels for the minSdkVersion and targetSdkVersion. However, if you specify that your application is compatible with a given version, make certain it really is! How do you know? Well, you’ll need to ensure that you only use Android SDK features that were introduced at the minSdkVersion API Level or lower. We’ll discuss how you determine this in a moment.


What versions are worth supporting? Knowing the most popular device versions on the market today can help you make this decision (Figure 2).





You can find the latest information, which is usually updated about every two weeks, on the Android developer website.


Don’t I Just Want to Target the Latest Android SDK?


Developers new to the platform often jump in and install the latest Android tools and Android SDK and think that everything will just work on all devices. This is not the case.


Every Android SDK feature, whether it’s a class, interface, method, constant or what have you, was introduced in a specific version of the SDK (specified by API Level). Therefore, you must ensure that your application only uses Android SDK features that correspond to the minSdkVersion API Level and lower. For instance, if you claim that your application is compatible with Android 1.6, or API Level 4, then you cannot use the dispatchGenericMotionEvent() method of the Activity class (http://developer.android.com/reference/android/app/Activity.html#dispatchGenericMotionEvent(android.view.MotionEvent), which was introduced in API Level 12, or Android 3.1. Note: there are ways to conditionally use different Android SDK methods at runtime but these techniques are beyond the scope of this beginner tutorial.


How Do I Know the API Level of an Android SDK Feature?


The Android API Level is listed in the Android SDK documentation. For classes and interfaces, the API Level is listed in the top right corner of the class reference documentation, as shown in Figure 3.





For constants, constructors, methods, and the like, the API level is listed on the far right of the descriptive write-up for the item, as shown in Figure 4.





By default, the Android SDK documentation displays API classes, methods and otherwise for all versions of the Android platform. However, you can filter the online documentation by API Level by setting the “Filter by API Level” setting at the top right-hand corner on the Reference tab of the Android Developer’s website documentation, as shown in Figure 5. API features that were introduced after that API Level will be grayed out.





Determining the Android Version of a Device


Android devices run a specific version of the platform. However, this version number can change over time, when carriers and operators push out over-the-air firmware upgrades to specific devices.


You cannot rely on a specific device always having a specific Android version. Different carriers may carry the same device, but roll out updates at different intervals, or not at all!


As a device user, you can determine the version of the Android platform by launching the Settings application, clicking “About phone” or “About tablet” (depends on your device type), and checking the value of the Android version setting. This will give you the Android platform version that is currently running on the device.


As a developer, you can programmatically check the Android platform version at runtime using the android.os.Build.VERSION class. See its class documentation for more details.


Conclusion


Android devices run different versions of the Android SDK. Versions are referred to by version number, code-name, and API Level. Developers need to be aware of what features of the Android SDK they are using to build their applications, as these design decisions affect what versions of the Android platform their application will be compatible with.


About the Authors


Mobile developers Lauren Darcey and Shane Conder have coauthored several books on Android development: an in-depth programming book entitled Android Wireless Application Development, Second Edition and Sams Teach Yourself Android Application Development in 24 Hours, Second Edition. When not writing, they spend their time developing mobile software at their company and providing consulting services. They can be reached at via email to androidwirelessdev+mt@gmail.com, via their blog at androidbook.blogspot.com, and on Twitter @androidwireless.

Need More Help Writing Android Apps? Check out our Latest Books and Resources!


Buy Android Wireless Application Development, 2nd Edition  Buy Sam's Teach Yourself Android Application Development in 24 Hours, Second Edition  Mamlambo code at Code Canyon

quinta-feira, 6 de outubro de 2011

This Week in Google 115

This Week in Google 115:



It Turns Into Underwear












Apple's iPhone 4S keynote, what is PhoneGap, # on Google +, Google won't screw up Android, and more cloud news.


Download or subscribe to this show at twit.tv/twig.


We invite you to read, add to, and amend our show notes.


Friendfeed links for this episode.


Thanks to Cachefly for the bandwidth for this show.









MP3 feed URL: 

http://www.podtrac.com/pts/redirect.mp3/twit.cachefly.net/twig0115.mp3




domingo, 2 de outubro de 2011

photos by Jacques Henri Lartigue

photos by Jacques Henri Lartigue:














































































Brassaï and Lartigue at the lunch at Montmajour Abbey ; on Brassaï's left, Jean-Maurice Rouquette. Photo by Jean Dieuzaide.

Minha lista de blogs