Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

March 21, 2016

Unity и разрешения в Android 6

Я столкнулся с проблемой появления на старте игры диалогов, запрашивающих пользователя о получении разрешений.

Должен сказать, что я выполняю экспорт проекта под Android и собираю его вручную. Я добавил несколько библиотек, которые используют кое-какие разрешения с уровнем безопасности "dangerous". Я также добавил их в AndroidManifest. Параметр targetSdk установлен в значение 23. Это значит, что мне нужно запрашивать разрешения во время выполнения.

Я удивился, когда увидел эти диалоги на старте. Я потратил много времени, пытаясь понять что происходит и какая библиотека выполняет эти запросы. Как оказалось, Unity умеет самостоятельно запрашивать разрешения начиная с версии 5.2.4.


Что ж, если вам нужно отключить этот функционал, то решение очень простое.

March 18, 2016

Unity and permissions in Android 6

I faced with a problem of appearing "ask-permissions" dialog at the starting up of my app.

At first I need to say that I've exported android project and built it manually. I've added few java-libs which use some permissions with protection level "dangerous". I've added them to AndroidManifest as well. My targetSdk parameter is 23. This means I have to ask for permissions at run-time.

I was wondered that "ask-permissions" dialog appeared at the beginning. I spent lot of time trying to understand what happens. As it turned out, Unity brought this behavior as default starting from version 5.2.4.


Well, if you want to disable this feature, solution is very simple.

March 09, 2016

Андроид статистика от 7 марта

Последняя статистика о версиях Андроида доступна на сайте developer.android.com как обычно. Мы можем видеть, как KitKat продолжает терять своих пользователей, и, с другой стороны, здесь уже заметен прогресс для Lollipop и Marshmallow. Это хорошая причина переключиться на minSdkVersion=19.

Я понял, что страница "Android Dashboards" нуждается в других типах данных в секции "Screen Sizes and Densities".

Android Dashboards - March 7th

Latest statistics about version of Android available on developer.android.com as usual. We can see KitKat keeps losing its users and from other side here is stable progress for Lollipop and Marshmallow. It's a very good reason to switch for minSdkVersion=19.

I've realized that page "Android Dashboards" needs another set of data in section "Screen Sizes and Densities".

February 08, 2016

February 06, 2016

Android Dev Tips: How to replace Enum by int or String efficiently?

There's a good topic on developer.android.com about how to manage app's memory. I want to touch specific paragraph about enums:
Enums often require more than twice as much memory as static constants. You should strictly avoid using enums on Android.
Lot of developers don't want to follow this rule, saying this is inconvenient, hard to navigate through code, hard to debug, blah-blah-blah... 

Android guys want to help developers with this. They provided android.support.annotation package with lot of powerful annotations for Android Studio and Lint. I want to explain more about IntDef and StringDef. There two classes may help to replace enums efficiently for both: performance and convenience.

February 05, 2016

Android Dev Tips - How to get static Application Context from anywhere?

Everyone is facing with the problem of accessing Context instance from methods, which aren't logically linked with Activity or Service.

It may be needed for accessing independent resources, like strings or files from assets folder. Sometimes it may be inconvenient to initialize and keep additional variable with the static context.

There're lot of questions on StackOverflow about this. Today I want to share my experience of handling such kind of problems.


February 04, 2016

Android Dashboards - February 1st

Do you still care how to choose min SDK version? Last two years Google guys spent lot of efforts in order to make Android more fluent for vendors. The most popular devices now regularly receive firmware updates automatically. From the developer's point of view it's a fantastic! We don't need to care about dino-phones anymore.

You can see it by yourself from latest statistics from Google. Devices with API 19 and higher now cover more than 70% of market! This means we can use lot of modern features of Android KitKat, Lollipop and Marshmallow without tons of libraries and crutches.

You can find more details here.


November 04, 2014

Android Dashboards - November 3rd

This post relates to statistics of Android versions presented on market. New statistics was published as usually 3rd November on developer.android.com. Google should start shipping of new Nexus devices soon. So, we will wait for a Lollipop statistics after one month. And now you can discover the newest chart with the API levels of Android. Detailed history and forecast available here.


September 11, 2014

Android Dashboards - September, 9th

New statistics about devices is available on developer.android.com. Gingerbread and Ice Cream Sandwich are disappearing from market continuously.

Find history and forecast in this document.

June 12, 2014

How to add Facebook 'Like' button in Android app?

Official Facebook SDK does not provide implementation of theirs plugin 'Like' for Android. There is just html-plugin designed for web-sites and applications. Let's try to adapt this plugin for Android!

June 07, 2014

Android FontIcon library available from Maven Central

The latest version of FontIcon library for Android is available from Maven Central repository. It's easy to include it in project:

Gradle

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.shamanland:fonticon:0.1.6'
}

Links

Android Dashboards - June, 4th

This month Honeycomb devices are disappeared from official statistics about Android devices. There are three stable groups of API versions:
  • Gingerbread (API 10) - 15%
  • Ice Cream Sandwich and Jelly Bean (API 15-18) - 70%
  • KitKat (API 19) - 14%
Check details in this public spreadsheet.


May 19, 2014

Facebook SDK available from Maven repository

I don't know why Facebook still not published theirs SDK to Maven Central.
Well, nobody forbids us to deploy it to Sonatype repository!

May 05, 2014

Android Dashboards - May, 1st

Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.

April 23, 2014

FontIcon Library now supports ColorStateList

New feature added to the FontIcon Library latest version 0.1.1.

Now it's possible to set color-selector for icons. FontIconDrawable will handle changing the state, propagated from parental Button, TextView, etc.

March 05, 2014

Android Dashboards - March, 3

Latest statistics about Android devices is available on developer.android.com. As usual we publish additional statistics in public Google document. You can check previous history and forecast for next month.

February 07, 2014

Android Dashboards. February 4th. Gingerbread still alive.

Google published new statistics about active Android versions. The most important information is about Gingerbread. Many developers dream to stop support it. But it's still alive!

Last month we made forecast and it was wrong. Check updated document and make your own conclusion: support it or not.

January 14, 2014

Android. Support library. Nested fragments and startActivityForResult()

This post will be dedicated for nested Fragments from support library and for their big issue.

There are available methods inside Fragment: startActivityForResult() and onActivityResult(). First one just delegates invocation to FragmentActivty.startActivityFromFragment(), and second one is called from FragmentActivity.onActivityResult().

If this behavior just wrapped around Activity, then how result is delivered into Fragment instance?

January 12, 2014

Android Dashboards - Statistics of first 7 days of 2014 year

Android developers still should care about Gingerbread users. Every month Google publishes platform statistics collected from Play Store.

We are keeping previous statistics and it's quite easy to make some forecast. Month ago we made such forecast for January. Let's check it...