---
# System prepended metadata

title: A very brief intro to Android vs iOS
tags: [Mobile Development]

---

# A very brief intro to Android vs iOS

###### tags: `Mobile Development`

Notes based on: https://www.linkedin.com/learning/learning-ios-for-android-developers/welcome?u=2062740

> Please note that the programming language section will not be covered in detail, as the language only matters if you are developing specifically for that platform.

> If you find the notes to be too brief and want to learn more indepth on each topic, be sure to checkout the [Android Developer Site](https://developer.android.com/docs) & [iOS developer site](https://developer.apple.com/documentation/)!

## Android

### Activity Life Cycle

The event loop is initialized when the app moves to the foreground.

![](https://i.imgur.com/Ta2R9w2.png)

- `onCreate`: initialize resources and create the UI. 
- `onPause`and/or `onDestroy`: save changes to data before your app moves from the foreground to the background or your app process is destroyed.

### Android Services 
There are two types of Android Services. 
1. **Started services**: merely set off on their assigned task until finished.
2. **Bound services**:  provides a handle for other components to interact with and receive notifications

![](https://i.imgur.com/YMLbjrA.png)

### Android Broadcast Receivers

Broadcast Receivers can be declared either in the **Android Manifest** or the **Context**. 

- For those declared in the `AndroidManifest.xml`, the receiver will still be registered even when the app is closed. 
- For those declared in the `Context` object, the receiver will be registered as long as the `Context` is still in scope.

These receivers will be on *listening mode* and when they receive an appropriate broadcast, they will call the `onReceive` method to cause a change in the app that they are designated for.

![](https://i.imgur.com/GmQUDzj.png)

For the resources of each app such as images, videos and contacts, they are provided via the **Content Provider**. Outside apps cannot access the app's resources directly and have to request content from the Content Provider of the app. There also exist the System Content Providers which can provide an app's data to outside apps. 

![](https://i.imgur.com/r5XbSJo.png)

## Programming

Java code is compiled into  ByteCodes (`*.class`) that can be interpreted by the Java Virtual Machine (Android Runtime) and can be run by the Android OS Hardware.

![](https://i.imgur.com/u2xqi9s.png)


## iOS

### Activity Life Cycle 

- `willFinishLaunchingWithOptions`: the initiation of UI and resources
- `applicationWillResignActive`: Save data before app moves to the background
- `applicationWillTerminate`: This method is different from Android and may not be called. Hence it is not recommended to do any cleanup / saving of state here. Cleanup must happen earlier in the life cycle.

![](https://i.imgur.com/MGUrhGf.png)

## Programming

Swift is compiled into Binary Code that can run on OS devices.

![](https://i.imgur.com/5NfwKsa.png)


## Comparison Tables

### Life Cycle
![](https://i.imgur.com/rZc46hY.png)
![](https://i.imgur.com/girS5aV.png)

### Development Tools
![](https://i.imgur.com/I8teR4A.png)



