• Powerful refactoring tools • Code analysis • Integration with Google services ◦ URL and App Indexing support ◦ App Engine integration ◦ Google play services • Testing • Powerful Layout Editor and Translations Editor
existing app resources without building a new APK Gradle version 2.0.0 or higher Targeting devices running Android 4.0 Still a bit flaky (it does not play well data binding)
Android Emulator • It’s a Mac OS X i386 app • Debugging tools: ◦ Graphics rendering ◦ Location ◦ Localizations ◦ Accessibility ◦ iCloud • Still missing real multitouch (and force touch)!
दु नया Bonjour monde • Translating iOS apps sucks eggs • Obscure command-line tools and formats • The lazy man’s approach: Google Sheets! • Here’s my template: https://goo.gl/k4A3sa • Demo!
and a private key and off you go gradle assembleRelease Or just use Android Studio: Build > Generate Signed APK Submitting an Android app in the Google Play store is just super easy release { storeFile file("_market/android_market.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" }
(almost never, right?) • Always do staging releases • Use Beta and Alpha distribution channels • It is possible to make experiments • And much more... Google Play Developer Console
more important than Android • It is not included in the Android Open-Source Project (AOSP) • Device manufacturers: Why u not update? No need to multidex: compile 'com.google.android.gms:play-services-appindexing:8.4.0' compile 'com.google.android.gms:play-services-analytics:8.4.0' compile 'com.google.android.gms:play-services-gcm:8.4.0' compile 'com.google.android.gms:play-services-maps:8.4.0'
services - It is enough to support the latest 2 major versions of iOS - Adoption rate is so high that this covers 95% of iOS users And there are ways to check which version you run: guard #available(iOS 9, *) else { return }
• Apps declare custom URL schemes, e.g. localch:// • Apps can check if the system can open a URL* • Parameters are passed in the URL: localch://tel/search?what=vikram
or lock screen) • This is because they run on the original App process Very limited with a small set of UI elements It is basically a broadcast receiver… … but are we limited to widgets on Android? Not really
It is out of beta. Current version 1.0.1 It runs on the Java Virtual Machine (it also can be compiled to JavaScript) fun main(args : Array<String>) { val scope = "App Builders" println("Hello, $scope!") }
Java code to Kotlin directly from Android Studio Support for Higher-Order Functions and Lambdas import kotlinx.android.synthetic.main.activity_main.* public class MyActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) textView.setText("Hello, world!") // No need for findView(R.id.textView) } }
for iPhone and iPad hardware • Up to 10x faster than drawing with OpenGL • "Bare metal" API with less driver overhead and more direct control over the GPU on the A7 chip
Google literally crawls your app and associates it to search results Used at local.ch: it increased usage by 5% Used on iOS with deep linking… Still trying to figure out if it works
Play will ask for critical permissions. No way to know if you already asked The activity gets the callback Lots of conditional code It is still better and probably cleaner than on iOS Confusing at the beginning… Maps anyone?
is right • Location, Contacts, Notifications, Photos, Camera, Microphone, Bluetooth, HealthKit… • Explain why your app needs it • Allow user to change their mind
Android 2.1 (Api v7) Similar to ButterKnife or what Xcode does in Interface Builder (outlets) But it lets you run code with an Expression Language similar to Java You can have observable objects, fields and collections Support for basic data types and collections
same time The other app will be paused and not stopped (activity lifecycle) And a new Intent flag: Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT Picture-in-Picture for Android TV, to run in miniature form on top of everything else <activity android:name=".AppBuildersDemo" android:resizeableActivity="true"> <layout android:minimalSize="500dp"/>
from Android Wear • Direct Reply • Grouping notifications: ◦ Enabled by default on all apps. ◦ Summary customizable. Compatible with older versions of Android thanks to NotificationCompat
has unlocked an encrypted device Imagine your phone restarts while you are asleep Good for alarm clock and for incoming calls <receiver android:name=".SecureBootReceiver" android:directBootAware="true"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver>
asking for READ_EXTERNAL_STORAGE ..or accessing a Directory on Removable Media • Adding a BroadcastReceiver that listens for the MEDIA_MOUNTED notification StorageManager sm = (StorageManager)getSystemService(Context. STORAGE_SERVICE); StorageVolume sv = sm.getPrimaryStorageVolume(); Intent intent = sv.createAccessIntent(Environment.DIRECTORY_PICTURES); startActivityForResult(intent, request_code);
the first Death Star in Empire units (m/s^2) 3.5303614E-7 public static final float GRAVITY_THE_ISLAND of the island (Lost): 4.815162 Log: public static int wtf (String tag, Throwable tr) What a terrible failure
if the user interface is currently being messed with by a monkey. AdapterViewFlipper: public void fyiWillBeAdvancedByHostKThx () Called by an AppWidgetHost to indicate that it will be automatically advancing the views of this AdapterViewFlipper by calling advance() at some point in the future. UserManager: public boolean isUserAGoat () Used to determine whether the user making this call is subject to teleportations. As of LOLLIPOP, this method can now automatically identify goats using advanced goat recognition technology.
timeout) Public but not in the official API. It runs the specified task synchronously. However, this problem is often a symptom of bad design. Consider improving the design (if possible) before resorting to this method. Boring classes BoringLayout is a very simple Layout implementation for text that fits on a single line and is all left-to-right characters. You will probably never want to make one of these yourself. BoringSSL is the SSL library in Chrome/Chromium an Android (boring indeed)
in two steps. 1) It compiles the source code to an intermediate form. (front end) 2) Converting the virtual assembly language into machine language of the target computer. (back end)
of an app that can be used to re-compile it in different ways, given a set of instructions. Apple can simply add support for new CPUs to the “back end” on the App Store, which will show Bitcode how to compile down to new architecture.
lets you perform certain actions • Launch a time tracking app when you are at work • Do something when you get an SMS from a certain friend • Open spotify when plugging your headphone Automate device actions the way IFTTT interacts between web services Tasker relies heavily on intents to do such things Being able to do this kind of things makes Android awesome
Like running a view on top of everything else Getting a broadcasts when the device starts up or gets a phone call Having a service that runs in the background • At the cost of draining the battery of your phone in no time… No memory leaks since it runs on a Java in a VM and there is a GC. Right?
and properties Demo how you can set properties on the view (modify layer?) with runtime attributes Talk about how data binding has been with us since the start: Outlets connect Actions, Properties, Segues, Layout Constraints with your code Designables – complete custom views that can be
more than one language Call LocaleList.getDefault() to get the full list • Show search results in multiple languages • No more annoying popups offering to translate content
run in the background. It is an effort to prevent memory thrashing in response to an implicit broadcast JobScheduler will trigger jobs on ContentProvider updates: CONNECTIVITY_CHANGED will not trigger receivers declared in manifest NEW_PICTURE and NEW_VIDEO cannot longer be sent or received. No more camera freezing! But fear not: if the app is already running it will get the broadcast with context. registerReceiver
Do not keep long-lived references to a context-activity Try using the context-application • But do not use the App context for everything • Do you do not use the application context for things that have to do with UI • https://possiblemobile.com/2013/06/context/ Avoid non-static inner classes in an activity (use weak references to activities)
Dalvik Debug Monitor Server Run MAT (Eclipse Memory Analizer - http://www.eclipse.org/mat/) Very tedious Use https://github.com/square/leakcanary instead
app and react according to that ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.isActiveNetworkMetered()) { // Checks user’s Data Saver settings. switch (connMgr.getRestrictBackgroundStatus()) { case RESTRICT_BACKGROUND_STATUS_ENABLED: // Background data usage is blocked for this app. Wherever possible, // the app should also use less data in the foreground. case RESTRICT_BACKGROUND_STATUS_WHITELISTED: // The app is whitelisted. Wherever possible, // the app should use less data in the foreground and background. case RESTRICT_BACKGROUND_STATUS_DISABLED: // Data Saver is disabled. Since the device is connected to a // metered network, the app should use less data wherever possible. } } Android N: Data Saver improvements