Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Disclaimers

Slide 3

Slide 3 text

Xcode Some features: ● Swift and Objective-C ● Powerful refactoring tools ● Interface Builder ● Storyboards ● 2D & 3D Scenes ● Particle designer! ● Playgrounds! ● etc.

Slide 4

Slide 4 text

Xcode Some features: ● Swift and Objective-C ● Powerful refactoring tools ● Interface Builder ● Storyboards ● 2D & 3D Scenes ● Particle designer! ● Playgrounds! ● etc.

Slide 5

Slide 5 text

Xcode

Slide 6

Slide 6 text

Android Studio: IntelliJ 15 Some features: ● Best Java IDE ● 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

Slide 7

Slide 7 text

Android Studio: Android Emulator No more 10 minutes boot time with Intel® Hardware Accelerated Execution Manager

Slide 8

Slide 8 text

Android Studio 2.0: Instant Run Pushes changes to methods and 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)

Slide 9

Slide 9 text

Simulator: iOS, watchOS, tvOS Some features: ● Much faster than 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)!

Slide 10

Slide 10 text

Android Studio: Translations Editor View and update all your string resources in one convenient place. ● “Order a translation” ● Refactor!

Slide 11

Slide 11 text

Localizing Apps Hello world Hallo Welt Hola mundo नम ते दु नया 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!

Slide 12

Slide 12 text

Even more laziness: Localizing Apps prefix func ~ (key: String) -> String { return NSLocalizedString(key, comment: "No Comment") } print(~"hello") > Hola

Slide 13

Slide 13 text

Gradle Natively supported by Android Studio Multiple dependencies support It is also a build system, not just a dependency manager (like cocoapods): ● Top level build file + Module level build files

Slide 14

Slide 14 text

Gradle tips Check for the latest version: ● http://gradleplease.appspot.com/ dataBinding: enabled true dexOptions: javaMaxHeapSize 2048 For the brave: useJack true Testing: testCompile (src/test) and androidTestCompile (src/androidTest))

Slide 15

Slide 15 text

Third Party Libraries & Dependencies ● Cocoapods ● Carthage ● Swift Package Manager target 'MyBeautifulApp' do pod 'AFNetworking', '~> 3.0' end

Slide 16

Slide 16 text

Xcode UI Testing Demo XCTAssert(app.buttons["OK"].exists) snapshot("0Detail") *Snapshot courtesy of Felix Krause and fastlane.tools

Slide 17

Slide 17 text

Getting ready to submit an app: Proguard Obfuscate all ze things! ● minifyEnabled true Shrink resources! ● shrinkResources true ● Important to remove unused library code Beware: -keep public class MySpecialClass Backup output files (specially mapping.txt)

Slide 18

Slide 18 text

Getting ready to submit an app: Signing Create a Keystore 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" }

Slide 19

Slide 19 text

Equivalent to iTunes Connect but... ● No App review process (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

Slide 20

Slide 20 text

Getting to the App Store: iTunes Connect ● Apple review process ○ Quality filter ○ Expedited review ● TestFlight ○ Internal ○ External

Slide 21

Slide 21 text

Android Studio: Cloud Test Lab Temporarily available to use at no charge Run Instrumentation tests or Robo tests (if you do not have tests)

Slide 22

Slide 22 text

Apple Device Cloud ● Thousands of devices available remotely for testing! ● Just kidding! ● Seriously, what fragmentation? ● Developers can get away with 3-4 hardware devices ● iOS update propagation is phenomenal

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Google Play Services Over 90% Adoption rate Google Play Services: 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'

Slide 26

Slide 26 text

Apple’s Strategy No need to have a separate library of 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 }

Slide 27

Slide 27 text

Intents Intents are messaging objects to request action from other app components You can start an activity, a service or send a broadcast

Slide 28

Slide 28 text

iOS URL Schemes ● Simple way to launch another app ● 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

Slide 29

Slide 29 text

iOS Extensions ● Action ● Audio Unit ● Content Blocker ● Custom Keyboard ● Document Provider ● Photo Editing ● Share ● Today widget

Slide 30

Slide 30 text

iOS Today Extensions Similar to Android widgets. ● Get a quick update ● Perform a quick task in the Today view of Notification Center A use case: what are the next departures around me?

Slide 31

Slide 31 text

Widgets Remote views that run on other App (typically home 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

Slide 32

Slide 32 text

Android programming language Official language: Java…. Everybody knows Java these days. ● robust ● verbose ● ...boring But there are alternatives! ● Scala ● … and more

Slide 33

Slide 33 text

Kotlin Small runtime file size: 823Kb (vs 8Mb of Scala) 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) { val scope = "App Builders" println("Hello, $scope!") }

Slide 34

Slide 34 text

Kotlin Strong support for Android It is possible to convert 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) } }

Slide 35

Slide 35 text

Swift What? Swift on Android? Android support was merged not long time ago ● Requires the NDK ● https://github.com/apple/swift/pull/1442 https://github.com/SwiftAndroid/

Slide 36

Slide 36 text

Swift Some features: ● Optionals, unwrapping ● Type-inference ● Higher level functions ● Protocol-Oriented ● Etc. etc. ● Open Source!

Slide 37

Slide 37 text

Swift NSMutableString *hello = [[NSMutableString alloc] initWithString:@"Hello "]; [hello appendString:@"Objective-C"]; var hello = "Hello " hello += "Swift"

Slide 38

Slide 38 text

Vulkan Low level API brought by Khronos (OpenGL) Successor of Mantle (AMD) who donated it to the Khronos group Supported by everybody except Apple (Metal) Supported in Android N

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Metal ● Lower level alternative to OpenGL ES ● Optimized 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

Slide 41

Slide 41 text

App Indexing Mapping URLs to Activities Supports iOS and Android 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

Slide 42

Slide 42 text

iOS Continuity: Deep Linking ● App bundle specifies associated domains (entitlements) ● Website serves apple-app-site-association file: "applinks": { "apps": [], "details": { "HGPZCPK6NY.ch.local.search.launcher": { "paths": [ "*" ]

Slide 43

Slide 43 text

iOS Continuity: Handoff (and Spotlight) /// Updates the given user activity or creates one for this entry func updateUserActivity(activity: NSUserActivity?, ... { // Handoff support (since iOS 8.0) activity.title = title activity.userInfo = [kDetailActivityEntryIdKey: entryId] activity.webpageURL = myWebpageURL // Enable Handoff, Spotlight and public indexing activity.eligibleForHandoff = true activity.eligibleForSearch = true activity.eligibleForPublicIndexing = true

Slide 44

Slide 44 text

Runtime Permissions … Android M … Lower versions: Manifest. Google 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?

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Permissions on iOS ● Ask, but only when the time is right ● Location, Contacts, Notifications, Photos, Camera, Microphone, Bluetooth, HealthKit… ● Explain why your app needs it ● Allow user to change their mind

Slide 47

Slide 47 text

What’s new for 2016?

Slide 48

Slide 48 text

Data Binding Say goodbye to findViewById Support library down to 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

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Android N - Doze Doze is the new Doze It kicks in intervals called maintenance windows (screen off) It is doze as on M but better

Slide 51

Slide 51 text

Android N: Multi-Window Support Two apps on screen at the 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

Slide 52

Slide 52 text

Multitasking

Slide 53

Slide 53 text

Android N: Notifications Total visual redesign plus new functionalities Inspired from Android Wear ● Direct Reply ● Grouping notifications: ○ Enabled by default on all apps. ○ Summary customizable. Compatible with older versions of Android thanks to NotificationCompat

Slide 54

Slide 54 text

Android N: Direct Boot Start your app before a user has unlocked an encrypted device Imagine your phone restarts while you are asleep Good for alarm clock and for incoming calls

Slide 55

Slide 55 text

Android N: Scoped directory access Access directories like Photos without 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);

Slide 56

Slide 56 text

iOS Sandboxing iOS is very limited when letting apps work together Sandboxing prevents accessing the filesystem ● Only access to Photos can be enabled ● App Groups for sharing files between apps

Slide 57

Slide 57 text

Android fun SensorManager: ● public static final float GRAVITY_DEATH_STAR_I of 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

Slide 58

Slide 58 text

Android fun ActivityManager: public static boolean isUserAMonkey () Returns "true" 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.

Slide 59

Slide 59 text

Android fun Handler: public final boolean runWithScissors(final Runnable r, long 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)

Slide 60

Slide 60 text

Android Demo Permissions Data binding Draw overlays https://goo.gl/gB0qye

Slide 61

Slide 61 text

The Mythical Context Switch ● It does exist. ● But it can be good for you! ● Become a Mobile Ninja.

Slide 62

Slide 62 text

Become a Mobile Ninja.

Slide 63

Slide 63 text

Thank You. Vikram Kriplaney @krips - https://github.com/markiv Sebastián Vieira @seviu - https://github.com/seviu Check out this presentation (including bonus slides) here: https://goo.gl/IwqE3x

Slide 64

Slide 64 text

Awesome Android resources http://androidbackstage.blogspot.ch/ https://github.com/JStumpp/awesome-android https://github.com/wasabeef/awesome-android-ui https://www.youtube.com/user/androiddevelopers https://guides.codepath.com/android http://android-developers.blogspot.ch/ https://github.com/seviu/android-appbuilders

Slide 65

Slide 65 text

Awesome iOS on github https://github.com/vsouza/awesome-ios https://github.com/cjwirth/awesome-ios-ui https://github.com/matteocrippa/awesome-swift https://github.com/trending?l=swift https://github.com/trending?l=objectivec

Slide 66

Slide 66 text

Awesome iOS resources https://www.raywenderlich.com iOS Human Interface Guidelines (what everybody claims has read) http://www.cocoawithlove.com/ http://iosdevweekly.com/ And all the WWDC videos

Slide 67

Slide 67 text

Support libraries: It is about compatibility Google’s strategy to support all versions of iOS (down to Android 2.3) v4 Support Library ● App Components, User Interface, Accessibility, Content v7 appcompat library (ActionBar),cardview, gridlayout, mediarouter, palette, recyclerview, Preference Support v8 renderscript , V13, v14, v17 (Android TV), Annotations, Design... useLibrary 'org.apache.http.legacy'

Slide 68

Slide 68 text

Nearby Messages API

Slide 69

Slide 69 text

Jack and Jill ● Java Android Compiler Kit ● Jack Intermediate Library Linker

Slide 70

Slide 70 text

What is LLVM LLVM is a compiler technology which works 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)

Slide 71

Slide 71 text

Bitcode An “intermediate” language like Bitcode is an abstract encoding 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.

Slide 72

Slide 72 text

Tasker - or why Android is awesome Event based, tasker 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

Slide 73

Slide 73 text

Android and other things that you cannot do on iOS 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?

Slide 74

Slide 74 text

Stuff you can do on iOS but not on Android Storyboards Interactive Playgrounds! Low-latency audio 3D Touch, Peek and Pop Content Blockers!

Slide 75

Slide 75 text

iOS Storyboards And how you can tie them with actions 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

Slide 76

Slide 76 text

What’s new on Swift 3 https://github.com/apple/swift-evolution Stable ABI and Resilience Bye bye this: for (i=0; i<4; i++) { } No more var as function parameters Swift now belongs to the community (feel free to add features)

Slide 77

Slide 77 text

Android N: Multiple Locales Because there are people that speak 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

Slide 78

Slide 78 text

Android N: Project Svelte Focused on optimizing the way apps 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

Slide 79

Slide 79 text

Memory leaks … yes there are leaks. Mostly context leaks 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)

Slide 80

Slide 80 text

How to avoid memory leaks Capture the heap with the Dalvik Debug Monitor Server Run MAT (Eclipse Memory Analizer - http://www.eclipse.org/mat/) Very tedious Use https://github.com/square/leakcanary instead

Slide 81

Slide 81 text

iOS Instruments Profiling for: ● Performance ● Memory (and leaks) ● Energy ● Network ● Filesystem

Slide 82

Slide 82 text

We can know if data saver is active for our 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

Slide 83

Slide 83 text

Android Android Studio, Gradle, Kotlin, Vulkan,GCM, JobScheduler, App Indexing, Memory Leaks, Android N, Jack and Jill...

Slide 84

Slide 84 text

Xcode, Cocoapods, Swift, Metal, Push Notifications, Deep Linking, Networking, Memory Leaks, Extensions, LLVM... iOS