iOS

One of the key factors to the adoption of wearables is their battery life.

We already use laptops, smartphones and tablets that we need to charge almost everyday. Having a wearable device like a smartwatch implies one more device to charge. If our smartphone has a low battery level, we can find a place to charge it while we do some other things. With a smartwatch we need to take it off. We can’t check the time while it is charging, at least not just by looking at our wrist.

Battery life is an important feature that we should consider when choosing a smartwatch, so I have measured the battery drain of the Apple Watch. In this post I want to show the results.

These are the specifications of the Apple Watch that I have used for the tests:

Battery drain

I analyzed the battery drain of the Apple Watch doing a very basic use of it.

This means that I checked the time once in a while and I read some notifications. Nothing more. I didn’t spend time exploring apps from the watch, I didn’t use the maps nor I monitored any type of exercise.
The results indicate that the battery life of the Apple Watch is around 50 hours: a little more than 2 days.
Therefore if you do more actions with the Apple Watch than just simply checking the time or reading notifications, the battery life will be less than 2 days, which means you need to charge it everyday.

The following chart shows the battery drain over time.

Power reserve

When the battery level of the Apple Watch is very low, around 10%, the power reserve mode is started automatically. You can also start this mode in any moment from the Power glance or from the power off menu.

While in the power reserve mode, you can only see the time on the screen along with an icon showing the red battery level icon. The watch doesn’t react to your finger touch and you need to press the physical side button to see the time.

When the Apple Watch is in power reserve, the battery drain is much lower. This can be observed in the next chart, where the power reserve mode was enabled during some hours.

More results

Charging time
It takes around 120 minutes to charge the Apple Watch completely, that is around 2 hours.

Boot time
It takes around 1 minute and 10 seconds to boot the Apple Watch.

In this post I want to show you the first look at Apple Watch. This post includes: pairing the watch with your iPhone, the charger and what happens when the watch is disconnected from the paired iPhone.

My experience is that the Apple Watch is a cool gadget to wear, but I ended up using the phone for everything and the watch only to see the time. The Apple Watch is not really good to check the time, since the screen turns on automatically when you do the movement with your wrist. There are sometimes that I don’t do this movement, or that the watch does not detect it. In these cases, you have to touch the screen with your finger. Anyway the wrist movement detection works really good.

These are the specifications of the Apple Watch that I have used for this post:

The following image shows the box containing the Apple Watch. Two watch bands with different sizes are included.

Pairing the Apple Watch

You need your Apple Watch (of course) and the companion Apple Watch app on your iPhone.The companion Apple Watch app is available since iOS version 8.2. First make sure that you have updated your device to iOS 8.2 or later. You should see the following Apple Watch icon on your device.

Once you turn on your Apple Watch, it will ask you to set it up and pair it with your iPhone.
Open the Apple Watch app on your iPhone and follow the steps of the setup assistant. Finally press the “Start Pairing” button on your watch.

Both the watch and the phone display a screen indicating the syncing process.

When the syncing is finished, you’re ready to go!

Charging the Apple Watch

The charger is a magnetic charging cable. You only need to place your watch on the charger.

When the battery level of the Apple Watch is very low, around 10%, the power reserve mode is started automatically. You can also start this mode in any moment from the Power glance or from the power off menu.
While in the power reserve mode, you can only see the time on the screen along with an icon showing the red battery level icon. The watch doesn’t react to your finger touch and you need to press the physical side button to see the time.
The following left image shows the watch with low power level. The right image shows the watch while charging.

Disconnected from your iPhone

The Apple Watch needs your iPhone to support most of its features. If the watch can’t communicate with your phone, a red icon is displayed on the top part of the screen as shown in the following image.

When the phone is out of range, some apps won’t work on the watch.
As shown in the next left image, a red message warns the user that the data was last updated some days ago. The red icon indicating that the phone is not in range is displayed on the top right corner of the watch screen. The right image shows an application with no data at all.

In this post I want to show you how we can create the simplest iOS app that monitors and ranges devices that follow the iBeacon protocol. An iBeacon device is a BLE (Bluetooth Low Energy) device that transmits its identification information: UUID, major and minor.
You can learn more about iBeacon in this previous post here.

Project setup

Create a new empty project in XCode. You can select the Single View Application template.

Enable the permissions needed to use the Core Location services. To do this, add the following two properties in the .plist file of your app:

NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription.

Here is an example of these two properties:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is needed to monitor Beacons in range</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location is needed to monitor Beacons in range</string>

My Location Manager

Create the class that will manage all the beacon events: MyLocationManager.

Import the CoreLocation library in the .h file of your new class:

#import <CoreLocation/CoreLocation.h>

The MyLocationManager class is going to implement the CLLocationManagerDelegate protocol to receive the beacon events:

@interface MyLocationManager : NSObject <CLLocationManagerDelegate>

The MyLocationManager class also needs two methods so the app can start/stop monitoring iBeacons. Add these methods to the interface:

- (void)startMonitoringUUID:(NSString *)uuid;
- (void)stop;

Monitoring iBeacons

Open the implementation .m file of our MyLocationManager class and add a private property to keep an instance of the iOS system CLLocationManager class.

Line 3. Create an object of the CLLocationManager class.
Line 4. Set our MyLocationManager object as its delegate.
Line 7-8. Request permission.
Line 10-12. Create a region with the UUID received as parameter.
Line 14. Start monitoring for the recently created region.

Implement the delegate method to receive the iBeacon events. For this small sample app, iBeacon events are just printed to the app log:

Ranging iBeacons

Add the code to start ranging. A good approach is to start ranging once it has been detected that the user is inside a region. This code is added in the locationManager:didDetermineState:forRegion method:

The iBeacon standard is an extension of iOS Location Services. An iBeacon device is a BLE (Bluetooth Low Energy) device that transmits its identification information: UUID, major and minor. This information is hierarchical and the UUID is the beacon’s principal identifier.
The iBeacon functionality provided by iOS allows two types of actions:

Region Monitoring. Notifies when the user has entered the specified region.

Beacon Ranging. Determines the estimated proximity to the beacons in range: Immediate, Near, Far or Unknown.

A Region in iBeacon terms is a network of iBeacons defined by a shared identifier. A region can be specified by its UUID, major and minor. Major and minor identifiers are optional for a region, but the UUID is necessary.

iOS limits to 20 the number of regions that may be simultaneously monitored by a single app.

For example, if only the UUID is specified for a region, all the iBeacons with that UUID will be considered part of that region.

If we specify the UUID and also a major value for the region, then only the iBeacons with that UUID and major are considered as part of that region.

Once a region has been detected, the details of the iBeacons in range inside that region are obtained by ranging, not by monitoring.

Background detection

While the app is running in the foreground it can range to determine the signal strength between the iBeacons and the device. This ranging process is not allowed while the app is not running in the foreground. Only monitoring is allowed while the app is in the background/not running.
Region monitoring is capable of waking the app up from running in the background/not running when the app enters or exits the region. These are the only triggers that will wake the app from running the background/not running: entering or exiting a region. Once the app is awoken it can run for ~10 seconds if closed completely and ~2 minutes if it is running in the background.

Core Location Framework

iBeacon APIs are available in the Core Location Framework. The central point of this framework is the CLLocationManager class. An instance of this class is necessary to start/stop the location services, to configure them, and to receive the related events.
The CLLocationManager reference can be found here.

When we have a UITableView, sometimes we want to add some actions when the user swipes over a row of the table. We can capture swipes to the left, right, down or up directions.
To capture both left and right swipe gestures, add the following code to your UITableViewController in the viewDidLoad method.

The method locationInView returns the location of the gesture, represented as a point in the local coordinate system of the view. Using the indexPathForRowAtPoint method of the UITableView object, we can obtain the row of the gesture.

We could use also the same action method to handle all the swipe gestures. Change the action methods from handleSwipeLeft and handleSwipeRight to handleSwipe, and add the following method instead.

Finally, we have to add in the Info.plist file of our app the values for the keys NSLocationWhenInUseUsageDescription or/and NSLocationAlwaysUsageDescription. These values contain the messages that will be displayed to the user when requesting the authorization.

The following steps can be followed to create a Git repository from an existing XCode project.

Open the terminal and navigate to the directory containing your XCode project.

Execute the following commands to create a local Git repository:> git init
> git add .

Open your project using XCode.

Navigate to the menu “Source control” > “your project” > “Configure”.

Open the “Remotes” tab as shown in the following screenshot.

Click on the + button.

Add the remote repository indicating its remote address.

Now that the remote repository has been configured, we can commit the project. Navigate to “Source control” > “Commit”. You can check the “Push to remote” option or we can do it in two different steps. Click on the Commit button.

Push the local commit to the remote repository. Navigate to “Source control” > “Push”.

For my PhD I write scientific articles that are submitted to scientific journals or conferences. The objective is to get them accepted and published. Currently we have 3 papers accepted. One of them has recently been published, the only article written in Spanish. The journal is Iberian Journal of Information and Technologies.

The RISTI (Iberian Journal of Information Systems and Technologies) is a peer-reviewed scientific journal, published by Academy Publisher in association with AISTI (Iberian Association of Systems and Information Technology), which focuses the research and the innovative practical application in the field of information systems and technologies. It is a biannual journal that publishes original and innovative articles accepted in an evaluation process by, at least, three members of the Scientific Council.

The journal is published in electronic and print version. The electronic version is free access and here is the reference (APA style) and the link to my article:

In order to create passes and allow them to be recognized by Passbook, they have to be signed with a valid certificate. The certificate is associated to a specific type of pass, so we need to create a Pass Type ID and a certificate for each kind of pass we want to support.

To create a Pass Type ID, log in into your developer account, navigate to your member center and to the Certificates, Identifiers & Profiles page. In the identifiers section, select the Pass Type IDs option. From this page the passbook Type IDs are listed and we can edit them, delete them or create a new one. Click on the plus icon button to create a new ID. Type a description and type the ID which has to start with the “pass.” string.

Follow the next steps and the ID registration will be completed. The new ID should appear in the Pass Type IDs list.

To create the Pass Type ID Certificate, open the Production page from the Certificates section and click on the plus icon button to create a new one. Check the Pass Type ID Certificate option and click on the Continue button. In the next page we have to select the ID created before. Click on the Continue button.

Finally we have to upload our Certificate Signing Request file (.certSigningRequest). This request file can be obtained from the Keychain of a MacOS computer, but probably you already generated it when you created your app or created other certificates. Upload this request file, click on the Generate button and then we willl be able to download the certificate by clicking the Download button. The downloaded certificate is a .cer file.

When we want to learn a new language, it is a common thing to search for our own resources. These resources can be books or online sites with lessons, podcasts and exercises. A good alternative is to use mobile applications, even better if you can use a tablet.

Currently I am learning French and I am using mobile applications myself, so I have written a post about the ones I consider the most useful.

Being totally free, this app provides a variety of exercises that work on all the necessary areas: writing, listening, speaking… It is good for learning vocabulary and grammar, because all the exercises are based on sentences, so both of them are presented together, making it easy to learn.

What I like the most is the translation and listening exercises, in which you have to write whole sentences by translating the original or listening to it. This is more difficult and instructive than just choosing the correct answer from some possible options, like most of apps do.

Your progress is displayed as a nice hierarchy of levels and when it’s been a long time since you last used the app, you will have to do some refresher exercises.

This app is perfect to learn vocabulary. By playing games we can study the vocabulary and have fun with it. To make it more addictive, there are also challenges to get extra points and level up. A disadvantage is not having an app for Android.

What I like the most is that you can play the games using the vocabulary from all the lessons (or just some of them) at the same time, so they are not limited to a specific level, like most of apps do. This functionality is the best way to refresh the vocabulary.

Free but in-app costs to get all the levels: 4.49€ each level. Full course: 14.99€

Internet connection

Necessary to do some types of exercises

This app is the most expensive but it have a lot of different lessons with different types of exercises. In comparation to the other two apps, this app is not so good at making you memorize the vocabulary. The exercises consist on choosing the correct option from the proposed ones. There is not listening exercises and the writing exercises are corrected by the people from the bussu community.

What I like the most is the text comprehension exercise in which a text is displayed, audio included, and we have to answer questions about it. The other advantage of this app is that the language offer is wider.