With trying to get to grips with the Google APIs Client Library for Objective-C for REST I came across the need to search message parts to find the plain text and HTML content of each email. Although I haven’t settled on the final way to accomplish this, one way I am testing is using .filter on an array of GTLRGmail_MessagePart’s.[Read more…]
After authenticating with Google using GoogleSignIn, one of the next steps I wanted to tackle in my app was retrieving a list of messages. Here is the reference on this part of the API. What we see is that it requires a userId (which is your email address… or alternatively just the value “me”).
It has some optional query parameters such as indicating if you want to also include trash and spam folders, as well as filtering on labels. You can also pass in a query string in exactly the same format as you would the Google Search Box on email. Such as “from:[email protected]”, or just by keyword or phrase, etc…
On the right of the page there is also a way to test this out. In userId put in your email address and in labelIds, put in the word INBOX in CAPS.[Read more…]
I am currently in the process of building an email client app for iOS, and after that, the Mac. At the moment I am working on users being able to sign in to their Gmail account so that they can manage emails with within the app.
One of the first steps with working with the Gmail API is to be able to sign in. At the moment I have implemented GoogleSignIn which is one of a few ways that Google allows you to authenticate.[Read more…]
I was working with the Google APIs Client Library for Objective-C for REST today and when working on retrieving email messages from Gmail I noticed that the Data being passed, once decoded from base64, contained HTML in some cases. In this quick tutorial I’ll provide a quick example of one way that you can display a string containing HTML and put it in a UITextView.
Instead of showing how to retrieve an email from Gmail, and then access the data string and go through the conversion to make it a readable string, I’ll just begin from a hard-coded HTML string and show how that can be used in a UITextView.[Read more…]
I recently received a DJI/Ryze Tello as a gift from family. The Tello is a small drone weighing just 80g that works both indoors and outdoors (although you need good light and good conditions, ie, no wind, to be safe when using it outside). It has a downward facing vision system that allows it to stay steady when hovering. It works up to 100m away and is controlled by a smartphone or table via the Tello app.
The Tello has a 5mp camera on the front that streams 720p video to a phone or tablet. When you have a strong wifi signal, you can capture some fairly decent footage (not Spark, Air, or Mavic quality, mind you). There is no gimbal, although it does have electronic image stabilisation (EIS) which when the drone is in slow mode, it keeps the video level and fairly steady regardless of what direction you move the drone.[Read more…]
When developing an app, you might come across a need to pass some data from one view controller to the next view controller.
To demonstrate this functionality, we will create a very simple contacts application. The main view will use a UITableView to show first and last names of each individual in the custom contacts list. When tapping a name, the app will segue to a second view to show the contacts phone number and other details.
There are many ways we can solve this problem, such as using notifications or delegates to pass information around, but in this example we will pass some information from one view controller to the next view controller so that the “next” view controller knows what information to store.[Read more…]
We have previously looked at how to use region monitoring with iBeacons using a CLBeaconRegion. Today we’ll look at the CLCircularRegion for region monitoring. There are some similarities between the CLBeaconRegion and CLCircularRegion. Both inherit from CLRegion which means there are some aspects that they share. In our iBeacons tutorial we created region monitoring which looks out for bluetooth transmitters called iBeacons. When the app detects the iBeacon it triggers a delegate method to be called which allows you to inspect a major and minor value to know which region was triggered. You can program the app to detect when you come in to range, or when you leave range.
With the CLCircularRegion we use geo location instead of bluetooth signals. This allows us to create geo fences which are defined by a centre point on a map along with a radius. When the phone passes in or out of the CLCircularRegion, the appropriate delegate method is fired and your app can be programmed to act accordingly. Common uses include controlling a smart home and setting a geo fence which when you leave the fence, it switches off your heating. Popular todo task manager apps, such as OmniFocus, use geo fences to let you know when you enter a region on a map where you need to perform a task.
In todays tutorial we’ll look at how to create a CLCircularRegion and how to start monitoring for that region. [Read more…]
In this tutorial we will look at Device Motion which provides various measurements from the sensors on the iPhone. The data is represented by the CMDeviceMotion class which encapsulates measurements taken by the onboard sensors.
Rather than providing raw values from the accelerometer, gyroscope, or magnetometer, the CMDeviceMotion class provides data that has been processed by “Core Motion’s sensor fusion algorithms”. The data is cleaned up, and has bias removed.
In todays tutorial we’re going to look at how to access CMDeviceMotion and create a simple needle that faces down regardless of the direction you rotate the phone around the Z axis. [Read more…]
The iPhone packs in a number of sensors. We’ve covered the accelerometer, gyroscope, and magnetometer, and will now take a look at the built in barometer which first appeared in the iPhone 6 and 6 plus smartphones several years ago.
The barometer can be used to detect elevation changes by sensing the changes in air pressure as the phone increases or decreases in altitude.
In todays tutorial we’ll take a look at CMAltimeter which is the class we use to access the barometer. [Read more…]
Using the various sensors on your device, Apple is able to predict if you are walking, running, in a vehicle, or stationary. This is all done quietly in the background by way of the motion coprocessor that is found in all iPhones since the 5s.
In this tutorial we will look at how your app can read that information, either live, or historically from the last 7 days. The CMMotionActivityManager has both the live updates using the startActivityUpdates: method, or the historical data with queryActivityStarting: both of which we will use. [Read more…]