- Android Live Wallpaper — Tutorial
- 1. Pre-requisitions
- 2. Overview
- 2.1. Live Wallpapers
- 2.2. How to create a live wallpaper
- 2.3. Intent to set the wallpaper
- Creating Live Wallpapers on Android
- Step 0: Getting Started
- Step 1: Service or Engine?
- Step 2: Defining the Wallpaper
- Step 3: Wallpaper Service Engine Wiring
- Step 4: Some Notes On Performance
- Step 5: The Demo View
- Conclusion
- Топ приложений для смены живых обоев на вашем Android-смартфоне
- ZENTALED
- NEOLINE
- AMOLED LiveWallpaper
- WALLOOP
- Live Wallpaper Loops
- Particle Live Wallpaper n Play
- Holo Droid
Android Live Wallpaper — Tutorial
Android Live Wallpaper. This tutorial describes the creation of live wallpapers for Android. It is based on Eclipse 4.2, Java 1.6 and Android 4.1 (Ice Cream Sandwich).
1. Pre-requisitions
The following tutorial assumes that you have already basic knowledge in Android development. Please check the https://www.vogella.com/tutorials/Android/article.html — Android development tutorial to learn the basics.
2. Overview
2.1. Live Wallpapers
Live Wallpapers are animated, interactive backgrounds for the Android home screen. A live wallpaper is similar to other Android applications and can use most of the same functionality.
2.2. How to create a live wallpaper
To create a live wallpaper, you need to create an XML file which describes your wallpaper. This file should contain a description of the application and can contain a preview and a link to a preference activity Activity which allow to customize the live wallpaper.
You also create a service which must extend the WallpaperService class. This class is the base class for all live wallpapers in the system. You must implement the onCreateEngine() method and return an object of type android.service.wallpaper.WallpaperService.Engine . This objects handles the lifecycle events, animations and drawings of the wallpaper. The Engine class defines the life cycle methods, as for example onCreate() , onSurfaceCreated() , onVisibilityChanged() , onOffsetsChanged() , onTouchEvent() and onCommand() .
The service requires the permission android.permission.BIND_WALLPAPER and must be registered via an intent-filter for the android.service.wallpaper.WallpaperService action.
You should also enter in the AndroidManifest.xml file of the application that your application uses the android.software.live_wallpaper feature. This will prevent that your wallpaper can be installed on devices which do not support live wallpapers.
2.3. Intent to set the wallpaper
You can use an Intent to set the Wallpaper.
Источник
Creating Live Wallpapers on Android
Android has a number of personalization features to help users customize many aspects of their device user experience. One of these features is live wallpaper. Live wallpapers don’t remain as static background images but instead have interactive features. Learn how to create a live wallpaper in this tutorial!
A live wallpaper, on Android, is normally used as a background on the home screen that animates or changes over time in some way. If you have an Android device, you’ve probably seen a couple of the built-in live wallpapers, like the one where leaves appear to fall into rippling water.
As a developer, you can create and publish live wallpapers. The process is not particularly difficult. Making a live wallpaper that is fascinating and desirable while not draining the user’s device battery is, however, something of a challenge. In this tutorial, we’ll walk you through the process of creating a live wallpaper that behaves. 🙂
Step 0: Getting Started
Recently, we showed you how to use RenderScript. The end result of that tutorial was a simple snow-falling effect. Let’s turn that effect into a live wallpaper.
The open source code for this tutorial is available for download. We recommend using it to follow along. The code listings in this tutorial do not include the entire contents of each file and do not cover project setup or code covered in previous tutorials.
Step 1: Service or Engine?
You could say that a live wallpaper is just a service. After all, to create a live wallpaper, you simply extend from the WallpaperService class and implement a single method, often with just a single line of code, and then add your service definition to the manifest file.
Let’s see what this looks like. Here’s the WallpaperService:
And you’re done! Okay, not really. The bulk of the work of a live wallpaper takes place in a WallpaperService.Engine implementation. This is where you can respond to callbacks such as onSurfaceChanged() and onSurfaceCreated(). Sound familiar? These are very similar to the callbacks you may have seen when implementing a View or other Surface-based object.
And now the reality of live wallpapers is revealed: When implementing the WallpaperService.Engine, all you’re doing is drawing to a provided Surface (via a SurfaceHolder). It is almost that simple. Before we get to the implementation of the WallpaperService.Engine, let’s look at some of the other configuration aspects.
Step 2: Defining the Wallpaper
Since a live wallpaper is a service, you must register the service in your manifest file. The service registration might look something like this:
There are a couple of things to note here. First, using this service requires the BIND_WALLPAPER permission (i.e. another app using this wallpaper would require the BIND_WALLPAPER permission as a uses-permission entry in their manifest). Second, the intent filter is a string similar to the base class. Finally, the meta-data points to an XML file. This XML file, defined by the developer, provides some additional wallpaper configuration. Here’s our XML file for the live wallpaper settings called fallingsnow_wp:
Here, we simply use the regular launcher icon as the thumbnail and point to a string that will show up as the description in the listing of wallpapers. If your live wallpaper needs configuration, you’d point to it with the android:settingsActivity property.
Finally, back in your manifest file, don’t forget to set the uses-feature for android.software.live_wallpaper:
Step 3: Wallpaper Service Engine Wiring
Now that the boring, yet critical, stuff is out of the way, let’s return to the real work: creating the WallpaperService.Engine class. Since we already have a RenderScript file for doing some animation, all we need to do is link the rendering up to the new surface. The onSurfaceCreated() method of Engine is a great place to create the RenderScriptGL object we’ll need:
We also set the rendering priority to low — this is a live wallpaper and not a critical game or UI rendering engine. It should not slow down anything else on the system.
Clean this up in the onSurfaceDestroyed() method:
The onSurfaceChanged() method is a great place to initialize the RenderScript class. This is the first place where you find out details of what you’ll be rendering to, such as the width and height. This is also where we set the surface for the RenderScriptGL class.
It’s a good idea to stop the wallpaper when it’s not visible.
And that’s it. The live wallpaper rolls. Or animates. Or does whatever it is you want it to do.
Want to respond to taps? Override the onCommand() method of the WallpaperService.Engine class.
Want to adjust positions when the user swipes between home screen pages? Override the onOffsetsChanged() method of the WallpaperService.Engine class.
Want to know if the user is viewing the preview before setting the wallpaper? Call the isPreview() method of the WallpaperService.Engine class and check the results.
The full implementation of our WallpaperService.Engine class can be found in FallSnowWallpaperService.java of the open source project.
Let’s take a look at the Live Wallpaper:
That should look familiar; it’s the same thing we saw in the RenderScript activity.
Step 4: Some Notes On Performance
Live wallpapers are a great place to make highly efficient and great performing graphical effects. But you need to do so realizing that the user isn’t necessarily sitting there watching a demo (you know, like those from scene.org). What this means is that you may need to reduce frame rates, reduce pixels, polygon counts, or texture details to keep the wallpaper interesting, but not stressful on the CPU, GPU, and battery. If users find that your live wallpaper is eating their battery, it makes your app look bad and it makes their device seem weak with low battery life. A bad experience with an Android device causes all developers to suffer a bad rap.
Step 5: The Demo View
The demo view and activity (from the previous tutorial) is still available when the app launches. Instead of removing it, why not just add a handler so that when a user clicks on it, the live wallpaper settings will come up so the user can select the live wallpaper?
Why not, indeed! That was easy. On any clickable view, just add the android:onClick=»onWallpaperSettings» property and you’re good to go.
Here’s a still image:
Conclusion
Live wallpapers are a convenient way to expand your application beyond its typical boundaries. Got a role-playing game? Make some neat live wallpapers featuring the main characters. Just make sure you use common sense when rendering to the screen so that the user’s experience with their device does not suffer.
Let us know what cool live wallpapers you’re building in the comments!
Источник
Топ приложений для смены живых обоев на вашем Android-смартфоне
Многим пользователям функция живых обоев в Android пришлась по душе. И на виртуальной торговой площадке от Google представлена масса приложений для замены этого элемента интерфейса. Но как не запутаться и выбрать что-то действительно стоящее? Давайте попробуем разобраться и найти приложение, которое украсит ваш смартфон и подойдет именно вам. Сразу хочется отметить, что несмотря на всю свою привлекательность, живые обои не самым положительным образом влияют на время автономной работы смартфона, так что не забывайте об этом, устанавливая из на свое устройство.
ZENTALED
Приложение имеет кучу настроек и целый «склад» самых разных живых обоев, в том числе и для AMOLED-дисплеев. Также обои синхронизируются с гироскопом и могут двигаться когда вы изменяете положение своего смартфона.
NEOLINE
NEOLINE — это образец минимализма. Как следует из названия, упор сделан на неоновое свечение. Подойдет всем любителям стиля Retro Wave и стилистики 80-х. Как уверяют разработчики, приложение практически не влияет на время автономной работы вашего смартфона.
AMOLED LiveWallpaper
Программа предназначена исключительно для AMOLED-дисплеев. Зато выглядят обои на них просто прекрасно. В бесплатной версии можно пользоваться лишь стоковыми обоями, а вот за небольшую плату вы сможете изменить цвета, FPS и многое другое.
WALLOOP
WALLOOP — имеет одну из лучших коллекций живых обоев в Play Store. Помимо живых обоев есть также много и «не живых», а учитывая, что является бесплатным, его по праву можно назвать оним из лучших в своей категории.
Live Wallpaper Loops
Live Wallpaper Loops имеет массу статических изображений с анимированными элементами, что не так сильно высаживает батарею. «Киллер-фичей» же является возможность анимировать ваши собственные фотографии и использовать их в качестве живых обоев.
Particle Live Wallpaper n Play
Приложение не предлагает никаких изображений или 3D-эффектов. Вместо этого есть тысячи частиц, которые «оживают» после вашего прикосновения к экрану. Весьма интересный и, что самое главное, визуально привлекательный опыт от использования смартфона.
Holo Droid
Приложение «оживляет» статистику использования устройства. Все элементы легко масштабируются чтобы показать самое важное. Вы можете наблюдать за температурой, расходом батареи, используемой оперативной памятью, нагрузкой на процессор и за еще тонной дополнительной информации.
Не забудьте посетить нашу страничку в Яндекс.Дзен. Там регулярно появляются материалы, которых нет на сайте.
Новости, статьи и анонсы публикаций
Свободное общение и обсуждение материалов
Как перенести данные Android на iOS? На самом деле вариантов довольно много. Это либо мобильные приложения, которые устанавливаются на смартфоны и между ними создаётся пара для обмена данными по воздуху, либо компьютерный софт, требующий одновременного подключения обоих устройств. Но чаще всего пользователи выбирают официальное ПО, которое предлагает, например, Apple. У неё есть своё приложение под названием «Перенос на iOS», позволяющее быстро и относительно беспроблемно пересесть с Android на iOS. Вот только у Google такого приложения почему-то никогда не было. Но скоро будет.
Тик-ток ворвался в наши жизни с немыслимой скоростью. Короткие видео «на пару минут» захватили львиную долю контента. В Тик-Токе каждый найдет что-нибудь по душе. Сейчас трудно представить человека, не знающего, что это такое. На фоне этого, крупные компании вроде Instagram или ВКонтакте запускают свои аналоги. Неужели боятся конкуренции и не справляются с удержанием аудитории? На самом деле все сложнее. Рассказываем.
Сервис Google Drive стал доступен еще в 2012 году и сразу привлек внимание пользователей своей функциональностью. Благодаря большому количеству разного рода интеграций и отсутствию рекламы стал одним из самых популярных сервисов Google в принципе. Из огромного количества облачных пространств, появляющихся на горизонте сервис от Google и по сей день остается моим выбором. Но как и у любой другой платформы у нее есть свои недостатки. В статье постараюсь объяснить какие возможности имеет это облачное хранилище и почему год за годом я выбираю Google Drive?
Источник