From iOS to Android

Click here to load reader

  • date post

    16-Jul-2015
  • Category

    Mobile

  • view

    318
  • download

    3

Embed Size (px)

Transcript of From iOS to Android

  • MADRID NOV 21-22 2014

    From iOS To Android(or reverse)

    Jos Manuel Ortega Candel

    @jmortegac

    http://www.linkedin.com/jmortega1

  • MADRID NOV 21-22 2014

    https://speakerdeck.com/jmortega/

  • MADRID NOV 21-22 2014

    ARCHITECTURE / iOS / ANDROID

    TOOLS XCODE vs ANDROID STUDIO

    APPLICATIONS / PERMISSIONS / PRIVACY

    USER INTERFACE

    STATIC ANALYSIS CODE / TESTING

    CERTIFICATES AND SIGNING

    EMULATORS / MEMORY MANAGEMENT/ DATABASE

    APP PUBLISHING / DEVELOPER LIBRARIES

  • MADRID NOV 21-22 2014

    ARCHITECTURE

  • MADRID NOV 21-22 2014

    Android Architecture

    DALVIK ART

    Just-In-Time (JIT) Compilation Ahead-Of-Time (AOT)

    Compilation

    Cache builds up over time

    Boot times are faster

    Cache is built at first boot

    Rebooting device takes

    significantly longer

    Apps compiled when executed Stores Compiled Apps

    Consumes much more internal

    storage space

  • MADRID NOV 21-22 2014

    iOS Architecture

  • MADRID NOV 21-22 2014

    TOOLS

  • MADRID NOV 21-22 2014

    IDES Android iOS

    https://developer.android.com/sdk/

    installing/studio.html

    APPCode http://www.jetbrains.com/objc/

  • MADRID NOV 21-22 2014

    on Android Studio

    InteliJ IDE Based Maven based Build Dependency Combines Ant && Maven / Gradle Tasks

  • MADRID NOV 21-22 2014

    Android Studio

    Templates

  • MADRID NOV 21-22 2014

    Android Studio

    Project settings

  • MADRID NOV 21-22 2014

    XCode

    Provides multiple ios app templates

  • MADRID NOV 21-22 2014

    Xcode Project

    Testing on device

    Base SDK

  • MADRID NOV 21-22 2014

    Interface Builder

  • MADRID NOV 21-22 2014

    Instruments on iOS

    Debugging, performance analysis, and testing

    Real-time CPU, memory, disk, energy, and network

    usage

    Threads, network, and energy usage

    I/O system and thread activity

    Allows detecting memory leaks

  • MADRID NOV 21-22 2014

    APPLICATIONS

  • MADRID NOV 21-22 2014

    Android Applications

  • MADRID NOV 21-22 2014

    Android Layout Manager+ Device Preview

  • MADRID NOV 21-22 2014

    Android Applications

    import android.os.Bundle;

    import android.app.Activity;

    public class MainActivity extends Activity {

    @Override

    protected void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);}

    } public static void invokeWebBrowser(Activity activity){

    Intent intent = new Intent(Intent.ACTION_VIEW);

    intent.setData(Uri.parse("http://www.google.com"));

    activity.startActivity(intent);

    }

    Activity

    Intents [Explicit,Implicits]

    Services

    Content Providers[Sharing data between apps]

    Fragments from 3.0

  • MADRID NOV 21-22 2014

    Android components

  • MADRID NOV 21-22 2014

    Androids RecyclerView

    Adapter

    ViewHolder

    LayoutManager

    ItemDecoration

    ItemAnimator

    https://developer.android.com/training/material/lists-cards.html

  • MADRID NOV 21-22 2014

    Android Navigation Drawer

  • MADRID NOV 21-22 2014

    Layout Systems

    UINavigationBar

    UITableView

    TextView

    TextView

    LinearLayout

    TextView

    TextView

  • MADRID NOV 21-22 2014

    LifeCycle Applications

  • MADRID NOV 21-22 2014

    LifeCycle Applications

    - (BOOL)application:(UIApplication *)application

    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

    {

    self.window.rootViewController = self.navigationController;

    [self.window makeKeyAndVisible];

    return YES;

    }

  • MADRID NOV 21-22 2014

    iOS Applications

    C

    Objective C,[message passing]

    Swift

    PlayGround for leaning Swift

    Programming with Objetive-C in windows/

    linux

    http://www.gnustep.org/

    https://developer.apple.com/swift

  • MADRID NOV 21-22 2014

    Objective-C vs Swift

    NSString *string = @hello; let string = "hello" as NSString

    let s: NSString = "hello"

    var string: NSString = "hello"

    string= "Hello"

    NSLog(@This is a string); println("This is a string");

    NSArray *myArray = [NSArray

    arrayWithObjects:@string1", @string2", nil];

    var myArray = [string1", "string2"]

    var myArray : [String] =

    [string1", "string2"]

  • MADRID NOV 21-22 2014

    iOS Applications

    @synthesize will generate getter and setter

    methods for your @property

    @interface MyObject:NSObject {

    NSString *_name;

    }

    @property (nonatomic,assign) NSString* name;

    @end

    @implementation MyObject

    @synthesize name = _ name;

    @end

  • MADRID NOV 21-22 2014

    UIKit Framework

    UIButton

    UILabel

    UIImageView

    UITextField

    UIPickerView

    UIWindow

    UIView

    UIViewController

    NSObject,NSString,NSMutableString, NSDate,NSNumber

    Collections(NSArray, NSDictionary, NSSet,NSEnumerator)

    Foundation Framework

  • MADRID NOV 21-22 2014

    iOS Applications

    UIViewController is the parent for view Controllers

  • MADRID NOV 21-22 2014

    iOS Applications

    Organizer

  • MADRID NOV 21-22 2014

    iOS Applications

    Snippets in XCode

  • MADRID NOV 21-22 2014

    iOS Applications

  • MADRID NOV 21-22 2014

    iOS Applications

    #import

    @interface MyViewController : UIViewController {

    IBOutlet UITableView *table;

    NSMutableData *dataReceive;

    }

    @property(nonatomic,assign) NSMutableData *dataReceive;

    @end

    UIViewController interface MyViewController.h

    implementation MyViewController.m @implementation MyViewController

    @synthesize dataReceive,table;

    - (void)viewDidLoad{

    [super viewDidLoad];

    NSURL *url = [[NSURL alloc] initWithString:@url"]; self.dataReceive = [[NSMutableData data] retain];

    }

  • MADRID NOV 21-22 2014

    iOS Applications

    UINavigationController

  • MADRID NOV 21-22 2014

    iOS Applications

    UINavigationController

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary

    *)launchOptions {

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

    //Recuperamos el ViewController

    UIViewController *rootViewController = [storyboard instantiateInitialViewController];

    // Creamos un UINavigationController, que se encargar de controlar y almacenar los distintos

    viewControllers de nuestra aplicacin.

    UINavigationController *navigationController = [[UINavigationController

    alloc]initWithRootViewController:rootViewController];

    //Asignamos el navigationController como principal.

    self.window.rootViewController = navigationController; return YES;

    }

    -(IBAction)goToPantalla2:(id)sender { UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

    //Obtenemos el controlador con Identifier "Pantalla2"

    Pantalla2ViewController *pantalla2Controller = [storyBoard

    instantiateViewControllerWithIdentifier:@"Pantalla2"];

    //Lanzamos el controlador en el navigation de forma animada:

    [self.navigationController pushViewController:pantalla2Controller animated:YES]; }

  • MADRID NOV 21-22 2014

    Design patterns on iOS Applications MVC

    Target-action

    Delegate and protocols A delegate is an object that control of the user interface for that event.

  • MADRID NOV 21-22 2014

    ViewPager / UIPageViewController

    Swipe gesture

  • MADRID NOV 21-22 2014

    Multilanguage

    NSString *localizedString =

    NSLocalizedString(@"Hello",@DefaultString");

  • MADRID NOV 21-22 2014

    Certificates and Signing

    Android iOS

    Self-signed certificate

    Apps are signed by

    developers

    Apple certificate

    Apps are signed by Apple

    Java Keytool

    Generate a distribution

    provisioning profile

    Export + Sign APK

    iOS Provisioning Portal

    Debug and distribution

    certificate

    App ID (unique ID of your app)

    Set of device unique identifiers

    Developer certificate

  • MADRID NOV 21-22 2014

    Android Studio

    Export + Sign APK

  • MADRID NOV 21-22 2014

    PERMISSIONS

  • MADRID NOV 21-22 2014

    Permissions on Android

    AndroidManifest.xml Protection mechanism to interact with other

    applications

  • MADRID NOV 21-22 2014

    Permissions on iOS o Declare your application requirements in its manifest-like Info.plist.

    This is used only for ensuring device compatibility.

    o UIRequiredDeviceCapabilities allows you to list

    hardware-like capabilities that your app needs.

    o AppStore reads this information for filter installer

    devices.

  • MADRID NOV 21-22 2014

    Permissions on iOS