Geo-Fencing: Location-Based Mobile Engagement

geo-fence mobile app

 

What is a geo-fence?

A geo-fence is a virtual perimeter for a real-world geographic area. The virtual area is set up using global positioning system (GPS) technology. The majority of geo-fences work together with a mobile device and a downloaded mobile app. In most cases, as a mobile device enters a geo-fence, it triggers a pre-programmed action on the device.

 

 

How does a geo-fence work?

We will explain the process as if your geo-fence is working in conjunction with a mobile app.

First, the virtual area must be configured by an administrator in the backend of your mobile app. For many applications, this involves accessing a content management system and setting a longitude and latitude for the desired area. The administrator then determines how large the geographic boundary will be, in meters. The size of your geo-fence is set drawing a radius from the latitude and longitude and creates a virtual circle around your defined area. The final step is to determine what type of location-timed service you are going to provide, either a local notification or location-specific content.

Second, the user must have your app installed and they’ll require location services turned on for your app. It’s important to ensure the app users have location services turned on in order for your geo-fence to function.

 

How to use geo-fences

Geo-fencing is most commonly performed with local notifications. As a mobile device enters the pre-defined area, the device will become “activated” within the geo-fence. At 14 Oranges, we provide you two options for using geo-fences:

 

1. Automatically send a local notification to the user within seconds of the app user entering your defined perimeter. The notification can provide information, link them to other pages within the app, external URLs, and mobile resources.

2. Activate content that is only accessible when the app user is physically inside of the pre-defined area. When a user enters the area, they “unlock” new pieces of content in the app that would otherwise be inaccessible when they’re outside of the area.

 

Real-World Example: Snapchat

Snapchat uses geo-fence technology to enable specific filters as mobile devices enter new areas; this an example of “unlocking” location-based content. If you’ve used apps like Snapchat in the past, you’ve probably noticed this location-based service. Location-based filters and stickers are widely used with Snapchat. Most major cities in North America have their own unique Snapchat filter made with a geo-fence which covers city limits.

 

snapchat geo-fence

 

Benefits of geo-fences

There are countless benefits of geo-fence technology working with a mobile app, the most significant being improved mobile engagement. Geo-fencing allows you to notify your app users at the most relevant time or provide more relevant content. Businesses, governments, organizations, and events have a powerful toolkit for reaching their target audience in a timely fashion with geo-fences.

 

Geo-fences for Cities

 

geo-fence cities

 

Cities have a unique opportunity with geo-fence technology. Cities have a guaranteed user base for location-enabled services, as the citizens move around the city every day. Cities can set up geo-fences in the downtown shopping areas, parks and recreation facilities, and relevant boundaries.

Cities can use geo-fences to set up notifications to connect citizens to local deals, discounts, or events, and provide useful information about the physical area they’ve just entered. For example, as a user approaches a trailhead for a hike, they could be greeted with information about rules and safety in the outdoors.

 

Geo-fences for Associations

 

association geo-fence

 

Associations are able to use geo-fences in a few creative ways to enhance member engagement and the overall member (mobile) experience.

 

EVENTS:

Events are a great way to leverage geo-fence technology for associations and organizations. As attendees enter the venue, you’re able to greet them with an automated notification. A geo-fence could remind them about the day’s activities, schedule, or direct them to more content in the app. Add a new geo-fence for every day of the event, or set up a few smaller perimeters for larger events.

Also, associations can enable content that is only accessible when the app user is physically inside of the pre-defined radius. When a user enters the event, they “unlock” new content for the event that would otherwise be inaccessible when they’re outside of the area.

 

ADVOCACY:

Associations are routinely engaging members with grassroots advocacy campaigns. Try setting up a geo-fence around your state legislature or political building and remind users as they cross the radius to contact his or her representative. The notification will likely be viewed as relevant and less obstructive than usual push notifications, as the user is physically located near the building you’ve chosen.

If your mobile app integrates with KnowWho, an online government directory for advocacy, the geo-fence can link users to send an email or phone his or her representative regarding the advocacy issue.

 

MEMBER BENEFITS:

Many associations provide members with a variety of benefits. So many in fact, that members often forget what’s available to them. Enable geo-fence locations around physical storefronts for member benefits.

For example, an association may offer a bank or credit union account or car rental services with membership, so a geo-fence could be set up around those locations to send reminder notifications to members.

You will most likely require members to possess his or her membership card (QR Code) within the mobile app if they wish to redeem their benefits at the locations.

 

Geo-fences for Businesses

 

business geo-fence

 

Businesses with a physical storefront have a competitive advantage with geo-fencing, especially if the business has people returning often, like a restaurant or clothing store. If your business has multiple locations, you can configure separate location-timed notifications.

Sending a local notification to users who already have your app installed will go a long way for increased customer loyalty. For example, configure a geo-fence so when an app user gets within 2km of your storefront, they receive a push notification with a code for 10% off their next purchase. Within the notification, you can list the details of the promo, such as “valid only at our downtown location” or “expires within 24h”.

 

Potential Limitations

 

HIGH-RISE BUILDINGS

 

high rise building

 

It’s important to remember that geo-fences leverage longitude and latitude when generating a perimeter, so a geo-fence can only measure the width of a certain space and not the height.

Why is this important? High rise buildings present a few obstacles for geo-fences.

Example: For a 12 story building, only one geo-fence can be enabled for the entire building. You are not able to add a geo-fence for each floor as the user is passing through the same radius for each floor. If you are attempting to integrate location-based services for this type of scenario, a beacon would be a better fit.

Also, many high rise buildings may interfere with the connectivity of cellular devices to global positioning systems, meaning the geo-fence may not detect the device has entered the area.

 

LOCATION SERVICES

 

location services

We have already touched on location services, but it’s important to discuss again. At the end of the day, if the user does not have location services and data/wifi enabled, they will not receive the geo-fence content.

We recommend reminding users to turn on the feature in their settings, especially for city apps or events. Make sure you explain to the user the benefit of turning these services on and what type of information they will receive.

 

How to set up geo-fences with Info Grove

 

In Info Grove, we define geo-fences as “Location Links.” The reason for this is because geo-fences leverage user locations and often link users to a new location in the mobile app.

 

info grove mobile apps

 

Step 1: Define your geo-fence

The “Name” you choose is only for internal purposes and will not be seen by app users.

 

setting up a geo-fence

 


Step 2: Set your geo-fence

We recommend opening Google Maps and clicking on the centre of your desired location. After you click on the centre, Google Maps will automatically generate a longitude and latitude (example: 49.185974, -123.144002)

 

google maps geo-fence

 

Enter the longitude and latitude in the Info Grove backend. Then, determine how large you want your geo-fence to be. Info Grove recommends making the radius no smaller than 100m to improve accuracy of location services.

setting up a geo-fence

 


Step 3: Set your location-link (if necessary)

Info Grove gives you the option to redirect people when they click on the geo-fence. If you’re providing additional information, you can use this section to define the landing page in the app. You’re able to send users to any of the modules you’ve created in Info Grove. Setting a location is optional; however, if you leave the space blank it will launch the home page of the app when clicked on.

 

setting up a geo-fence

 


 

Step 4: Set local notification (if applicable)

 

 

 


End Result!

As app users enter your geo-fence they will be greeted with a timely local notification!

 

 

If you’re having trouble with your geo-fence, contact us at support@14oranges.com. Or, if you want to learn more about our geo-fence technology and Info Grove, contact us as sales@14oranges.com.

 

Info Grove Mobile Apps

 

Mobile Apps for Cities: 10 Citizen Engagement Features

city mobile apps

Cities across North America are developing mobile apps as a new way of reaching citizens in a mobile-first environment. In 2017, the average user spent over two hours a day on mobile apps, and over three hours a day for millennials. Mobile apps present a new avenue to reach citizens, gather insight and opinions, and connect them to local services and events. We often see cities tackling mobile communication with a single-focus app, such as a 311 report or garbage schedule app. While we do see immense value in these types of apps, we believe that a complete city app, with a wide-range of services, provides the most value to citizens. For example, the City of Hamilton uses our Info Grove platform to send emergency notifications, promote events, link citizens to jobs and other services.

 

In addition to the City of Hamilton, we’ve worked with the City of Surrey and several U.S. counties to provide new avenues for mobile-first citizen engagement. Here are the top 10 features to include in a city app for citizen engagement:

 

 

 

1. 311 Reports

 

 

311 report mobile app

 

 

Allow citizens to complete reports in the mobile app to notify city staff regarding important issues.

311 reports provide citizens with the tools to report any problems to the city, such as potholes, graffiti, or property damage. Ideally, you’re able to configure each report so it’s emailed to the appropriate staff member.

 

2. Emergency Notifications

 

 

emergency notification mobile app

 

 

Keep citizens up to date with push notifications for city emergencies.

The City of Hamilton uses push notifications to inform citizens about road closures, weather warnings, and changes in hours of operation for public facilities.

 

 

3. Startup Questions

 

 

personalized mobile app

 

 

Allow citizens to personalize their experience with the mobile app with startup questions.

Not every push notification needs to be sent to every app user. Startup questions give the power to the citizen to determine how often they want to be notified.

 

 

4. Spatial-Based Triggers

 

 

geofencing mobile app

 

 

Integrate geo-fence technology to alert citizens who enter a specific location with push notifications or location-specific content.

For example, when an app user reaches the trailhead for a hike, he or she would automatically be sent a push notification with trail details and any relevant information.

 

 

5. Things To Do

 

 

parks and rec mobile app

 

 

Provide an active directory of things to do in the city. Users should be able to sort by “near me”

Connect citizens to public parks, recreation facilities, hiking trails, shopping malls, bike routes, and other points of interest. The City of Surrey links users to its large system of bike routes for easy access.

 

 

6. Event Information

 

 

event mobile app

 

 

Keep citizens informed with everything happening in the city.

Allow citizens to add events to their native calendars, share on social media, and get directions. Create new content to promote new festivals and conferences in the city.

 

 

7. Weather

 

 

weather mobile app

 

 

A good mobile app has features that keep users coming back for more. Every citizen is interested in weather, right?

Including an active weather widget in the app encourages citizens to launch the app on an ongoing basis and will link them to other app features.

 

 

8. Contact Information

 

 

contact list mobile app

 

 

Two-way communication is vital. Provide citizens with a city contact list organized by citizen need or department.

Allow citizens to email, phone, or schedule a meeting with staff representatives.

 

 

9. City Resources

 

 

city job mobile app

 

 

The list of resources will vary depending on each city’s specific needs:

  • Garbage/recycling schedules
  • Jobs and employment opportunities
  • Renew dog licenses
  • Public transit schedules
  • Pay a parking ticket

 

 

10. Social Media Integration

 

 

social media mobile app

 

 

Gaining organic engagement on social media is difficult. Are citizens even viewing your Tweets?

Integrate your social media accounts in the app and connect users to your Facebook, Instagram, Twitter, or Youtube account.

 

Conclusion

 

The most important feature to include in a city app is updated content. Whatever features you decide to implement, whether a 311 report, garbage schedule, or local events, if your content is outdated or irrelevant you will not gain a consistent user base. Unfortunately, many cities fall behind in this category and we are left with archaic city apps in the app stores. To combat this challenge, a mobile app should find ways to integrate to current communications, such as a website hosted with WordPress or Drupal.

However, you’ll likely have content that does require ongoing maintenance. If you’re choosing to outsource your development to save costs and gain expertise, look for an app service that provides a backend content management system so non-technical staff can log in and update content — no coding required. Also, don’t forget to set up Google Firebase Analytics to track your success!

 

Interested in building a mobile app for your city? Click here to see if Info Grove is right for you!

 

Why Mobile Optimization Should Be Your Focus for 2018 REPOST: From Small Business BC

website development

To view the original post from Small Business BC, click here.


In 2017, nearly 70% of all media time was spent on smartphones, on either a mobile app or a website. Just a few years ago, having a website was the bare minimum for a business. In 2018, a mobile-responsive website is now the benchmark for success. As we move towards a mobile-first society, mobile optimization is necessary for customer engagement and retention. At the same time, we also see increased use of mobile apps by the public. So, what is best for your business? A mobile-responsive website or a mobile app?

Mobile Responsive Websites

Going with a mobile responsive website model has the following advantages:

  • Content is being increasingly consumed on mobile devices over desktop.

  • It helps site usability by improving the user interface and user experience, making it easier for customers to access your content. It’s important to ensure your content consistent across all platforms, including iPhones, Androids, iPads, tablets, and desktops.

  • Google values mobile-friendly websites, so it helps search rankings (SEO) while decreasing your bounce rate for mobile traffic.

  • Ideal for your social media marketing efforts on Facebook, Twitter, Instagram, etc., especially if you’re driving traffic back to your website.

  • Mobile ecommerce is on the rise. People are getting more comfortable completing shopping orders on mobile devices. Look at the latest stats from Black Friday and Cyber Monday from 2017.

  • Improves email marketing campaigns that direct traffic to websites, if the user opens emails on their smartphone.

Not sure when it’s time to take mobile engagement one step further? Here’s why a mobile app is better than a website for brand engagement, and when it’s time to upgrade.

Mobile App Advantages

  • Apps are faster than websites.

  • Apps are more convenient and familiar than mobile-websites.

  • Mobile apps can offer offline support to content without needing wifi or data.

  • Apps better integrate with social media and help increase organic engagement.

  • Apps provide improved access to onboard services (i.e. native calendar, GPS, Google Maps, beacons, camera, and targeted push notifications.)

When to Upgrade?

  • When mobile traffic surpasses desktop traffic.

  • When you’re ready to adjust to changing demographics (millennials)

  • When you see a high percentage of returning visitors (via analytics) and want to increase brand loyalty, engagement, and grow returning customers.

  • When your email open rate is lower than industry standard.

  • When you want to leverage targeted push notifications (based on age, location, interests, etc.)

  • Promote two-way communication by having forms, surveys, and polls in the app.

  • If you want to run mobile campaigns in 2018 by using notifications for promotions, events, and news. Encourage action by the user, such as “share on social to be entered to win!”, “add the event to your native calendar”, or “One-day sale! Stop by today!”

  • When you want to increase revenue and cut costs by adding banner advertisements in the app and cutting print media.

The first step for any business is to ensure your content is accessible across all devices. It’s important to consider the user interface and user experience as they interact with your mobile website or app. Review your current website analytics and display the primary use cases in easy to spot areas for all devices. For example, items such as contact us and services should be easy to find. Ensuring your website is mobile-responsive is the first step to converting website visitors into leads.

Mobile Apps for Associations: 6 Must-Have Features Member Engagement & Communication

association mobile apps

Advocacy associations often have a difficult time connecting with members regarding industry news and events. As email open rates decline, association executives are searching for new ways of reaching members to keep everyone informed. In order to match the changing demographics (millennials), associations are beginning to migrate to mobile apps.

Within the last few years, many advocacy associations have begun developing mobile apps to provide members with a mobile-first approach to engagement. Mobile-first strategies are implemented with the goal of allowing members to access content on the platform of their choice, and not limiting the user to a desktop. If your association is considering a mobile app for member engagement, here are six must-have features to guarantee mobile engagement.

1) Targeted push notifications

Sending a mass push notification is the same as sending a mass email, though useful, segmenting communication will increase engagement and open rates. Mobile apps for associations must be equipped with targeted push notifications so members don’t feel overwhelmed with constant alerts.

Associations should target members based on a variety of factors, such as age, location, personal interests, profession, etc. When members first launch the mobile app, they should be asked a series of questions to personalize their experience with your new app.

The Washington State Pharmacy Association asks users to list their profession (either pharmacist, retired, student, or pharmacist technician). In doing so, the WSPA can send news and information to those who it’s most relevant; meaning students will not be notified for events regarding retired professionals in Washington.

arkansas education association mobile app

2) Polls, surveys, and forms

When adopting a mobile-first strategy, integrating polls and surveys is critical for two-way communication. Associations are able to collect data and information that help better understand the needs and opinions of members for future development. It’s important to eliminate barriers that members face when attempting to engage with your association – make engagement as easy as possible.

Use polls to ask members about recent legislative initiatives, their favourite parts of the app, or whatever your association finds most important. Coupled with targeted push notifications, quick polls are a powerful tool to receive member insight fast.

It’s important to ensure that the polls you create are linked to a backend data source for collection and organization. If the poll requires immediate attention, such as a live event or political policy action, it would help for association staff to receive the forms via email or text if needed.

association mobile apps

3) Event integration

Gone are the days of “one-and-done” event apps. Associations are now realizing the value of a year-round mobile app as a platform for member engagement. As many marketers are aware, the hardest part of marketing your mobile app is getting people to download it to their personal devices. It’s believed that once a user has downloaded the app, you’ve passed the largest hurdle for mobile engagement. Provide the event schedule, speaker lists, sponsor list, etc., for event attendees to make the mobile app a must download.

It’s common for associations to have multiple events per year, whether an annual general conference, a local meeting, or even online webinars. A mobile app should allow your staff to create new pages and content for every event your association hosts.

Event pages in the app should allow users to add events to their native calendars and schedule reminders. To improve engagement, event pages should let users seamlessly share on social media to promote attendance by more members. Further, users should be able to find key information, such as directions, contact info, and links to sign up for the event.

Coupled with targeted push notifications and polls, your mobile app will provide a next-level event engagement strategy and create a new event experience for members.

Event app

4) Political contacts

At its foundation, advocacy associations strive to make positive change with respect to political policy and government action. An association mobile app should link users to their local state/provincial/municipal representative to contact via email or phone.

One mobile app integration to consider for political advocacy is KnowWho, a membership engagement service to contact legislature representatives. By adding a third party service like KnowWho, associations can run a mass advocacy campaign in a mobile environment with targeted push notifications. Send call-to-actions to members and ask them to send an email to their state representative through the app or share information on social media.

mobile app advocacy

5) Backend content management system

Mobile apps must make the life of association staff easier, not harder. Many mobile apps developed today are equipped with a backend content management system to allow staff to easily add and edit content. 14 Oranges’ Info Grove platform is easy to learn and offers drag and drop mechanisms along with simple data import capabilities.

A second way to reduce the workload for association staff is to provide unique logins for the backend of the mobile app. Specific staff should have their own login information and authority within the backend, meaning not all staff would have the same power to change content. Association executives should be able to appoint new staff to edit content or send a notification without fear of a mass application error. The backend should require no coding knowledge to make changes and add content!

Info Grove mobile apps CMS

6) Donation Portals

It’s essential for your mobile app to feature donation portals in easy to locate places to help streamline fundraising campaigns on mobile devices. For member donations, it works best to link members to your existing association web page from the app.

The Missouri Education Association uses its mobile app to link members to three separate donation portals: The PAC, the Hope Fund, and the Cheer Fund. By providing a donation portal in your mobile app, you are making the donation process as easy as possible for members.

association mobile apps infographic

Read more about Why Associations need a mobile app here.

14 Oranges provides mobile apps for associations across the U.S. and Canada. Info Grove is the platform designed to make mobile apps easy. With Info Grove, association staff can build a unique mobile app with features specific for each association. No coding required. Contact us today to see if Info Grove is right for your association.

Info Grove

Why Associations Need a Mobile App (Infographic)

arkansas association mobile app

14 Oranges develops mobile apps for advocacy associations and non-profits across the U.S. and Canada. As mobile media consumption rises, more associations are migrating to mobile apps to engage their members and the general public. From the Arkansas Education Association to the Washington State Pharmacy Association, advocacy groups are turning to mobile to find new ways of informing members about industry news, events, and resources. Several associations are also using mobile apps and push notifications to streamline donation campaigns in a mobile-first environment.

 

WSPA mobile app

 

Mobile apps offer a unique opportunity for member-based associations to stand out, attract new members, and improve engagement. Here’s a brief infographic outlining why your association needs a mobile app in 2018!

 

 

association mobile apps infographic

 

 

association mobile apps

 

Mobile Apps for Advocacy Associations

Looking for a mobile-first engagement strategy for your association? Click here to see if Info Grove mobile apps is right for your association.

 

 

Info Grove mobile apps

 

 

Keys In My Pocket: Why I Use Car Sharing Mobile Apps Evo & Car2Go

It was 5 years ago when I was first introduced to car sharing. I did not understand it nor buy into it. The entire concept of sharing vehicles with other people confused me. However, it did not take long for me to abandon this mindset when Car2go had an info booth on my university campus. Next thing I knew they offered me 30 free minutes of driving and I signed on the dotted line. Today, I use both the Evo and Car2Go mobile apps and in doing so, I always have a set of vehicle keys in my pocket.

 

 

How does it work? Car2Go & Evo. 

 

First, you have to register for a car sharing provider (they all have sign up fees but often offer promos) and download their mobile app. You’ll need a valid driver’s license and a clean driving record. When you have been approved, all you have to do is open the app, find the closest car to you and press “reserve/book this car.” Car2Go and Evo will hold your reservation for 30 minutes. Once you make it to your chosen vehicle, open the app again and press “start rental.” From here on you’re being charged per minute. When you’ve reached your destination, park the car in a designated spot, open the app and end your trip. However, car sharing operates with a “home zone” attached. Meaning as long as you leave the vehicle within that zone, your parking is free. These home zones cover the geographic boundaries of an associated city, so in most cases, this is not an issue.

 

Pricing.

 

For just 32-41 cents a minute, Car2go and Evo car sharing apps adapt to your life. Whether you’re doing a quick shopping trip or driving home from work, car sharing helps you get around a busy city. Evo and Car2go also offer pricing for longer trips. With Car2Go, you can take a smart car for 24 hours for just $65, and Evo charges $89 for the same period. A great part of Evo and Car2Go is that they only charge $2/year to keep your membership, meaning if you don’t drive you don’t pay!

 

 

 

Why own a car?

 

In a busy city like Vancouver, owning your own vehicle may not make the most sense. With public transit, bike lanes, and densely populated areas, a car may not be right for you. By using these services you have all of the benefits of owning a car without having to deal with all of the hassles. No oil changes, no insurance, no inflating tires, no maintenance, and no problems. You do not have to pay for gas or for parking (unless it is a metered spot). Car sharing is best for people who don’t need a vehicle everyday. With the costs associated with owning a car (insurance, gas, maintenance, and etc.), carsharing in an urban city is a perfect solution. Pay for when you use it, not for when you don’t.

 

Peace of mind.

 

The part of these services that I enjoy the most is the peace of mind. I know that at all times I have a way home. I know that living in Vancouver, there is most likely an available car within walking distance. No longer do I feel stranded left hoping a cab drives by or actually comes when I call (hint: we need Uber). Car sharing mobile apps connect us with our cities like never before. Mobility in your city should not cause stress, so download an app that gives you 24/7 access to car keys in your pocket.

 

 

Creating an API FAST with Slim Framework

We develop API’s very regularly at 14 Oranges, being that almost every app we have developed requires some sort of back end data source. Developing an API is really not a difficult process but there are lots of little things to consider and building one from scratch is just not always the best use of your time. We do about 90% of our server side development in php and have over the past 15 years done everything from creating our own frameworks to using popular frameworks like Cake, laravel, symfony, zend and codeigniter. But up until this week I had always ignored Slim framework. I figured if I didn’t need all the bells and whistles on a project offered by a full featured framework, I would be better just going to my own toolset.

Andrew, one of our developers, mentioned recently he was using Slim for an api related project, so when I had to develop a really quick proof of concept for a client recently, I figured I would take the time to try it out and I thought I would put some notes down for other developers that might be curious. I ended up turning it into a presentation for our company and decided to share my findings here in this post.

[read more="Click here to Read More" less="Read Less"]

I figured I would jump right in and install it, then look at a few examples, write some code and get it working before reading the documentation. I know, I know, RTFM, and I do … eventually. But I am a quick study and manuals more often than not put me to sleep.

My shortcut in this case paid off. I hadn’t gotten to reading the manual yet and my API was working as intended.. So I guess what I am saying is learning curve on Slim is really low.

I began by installing it via composer. You will have to have php installed first to complete this.

On my mac I created a new directory, opened up terminal and navigated to that directory and simply installed composer with this command.

curl -s https://getcomposer.org/installer | php

There are a couple routes to take next. You could install just the Slim framework and go from there or you could start with the slim-skeleton which basically does some of the initial setup for you and points you in the right direction. I went with the basic install but in retrospect I think installing the skeleton would be a better option.

I created my composer.json file containing the following:

{
   "require": {
     "slim/slim": "^3.0"
   }
 }

Lastly installed via composer with:

php composer.phar install

There you have it … took about 1 minute.

I created my index.php file and added some rewrite rules to ensure all requests were routed to this file in an .htaccess file. Lots of tutorials out there on how to do this so I will skip it. Inside the index.php file I had to require the autoload.php file that the Slim installation created, instantiate Slim and get going on my routing. Here is what that looks like.

<?php
 use \Psr\Http\Message\ServerRequestInterface as Request;
 use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

The Slim Framework’s router is built on top of the nikic/fastroute component, and its fast and easy to use. Here is what my index.php file ended up looking like with my first route defined, a base route basically just saying you need to authenticate.

<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require '../vendor/autoload.php';

$app = new \Slim\App;
 
$app->any('/', function (Request $request, Response $response) {
   $response->getBody()
   ->write("Welcome to the API. Please authenticate.")
   ->withHeader(''Content-type', 'application/json');
   return $response;
 });

 $app->run();
?>

The use statements at the top of the script are bringing the Request and Response classes in. Slim framework now supports PSR-7, a PHP standard for HTTP messaging. We then setup $app to contain an instance of Slim and add a route. When adding a route to a Slim application you can choose an HTTP request method (POST, GET, PUT, OPTIONS, PATCH, DELETE) or as I have done in this case you can allow the listener to accept requests with any HTTP method.

Every HTTP request has a method that is typically one of:

OPTIONS - a request for information about the communication options available on the request/response chain identified by the Request-URI.

GET - retrieve whatever information (in the form of an entity) is identified by the Request-URI.

HEAD - identical to GET except that the server MUST NOT return a message-body in the response.

POST - used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI

PUT - requests that the enclosed entity be stored under the supplied Request-URI.

DELETE - requests that the origin server delete the resource identified by the Request-URI

PATCH - requests that the items in the enclosed entity be stored under the supplied Request-URI (not a wholesale update).

SLIM implements each of these methods and allows you to create your own custom methods as well. The methods are not strictly enforced by SLIM so you can work with them as you see fit. You could really throw the other devs for a loop by returning error code 69 on HEAD but I really would not recommend that.

 

 

 

The second parameter for the route method is the callback function which is being passed the PSR-7 request and response objects. A route can look at the request and manipulate the response as required then return the response. Once all of the logic and business stuff is done you run the $app and away we go.

So in about 5 minutes of coding we have our api’s first endpoint operational. Any request to the base url of our API will respond with a 200 HTTP status (default in Slim) with a JSON content type and a response body of ‘Welcome to the API. Please authenticate.’.

Obviously the API the way it stands now is not overly useful but all we have to do is add our routes corresponding to the endpoints of our API and we will have the job done. So here is a full API implementing a really simple Authentication endpoint. Obviously this is not something I would use in the real world but it is a great example of how fast and easy Slim is to use.

<?php
 // INCLUDING THE PSR 7 REQUEST AND RESPONSE CLASSES
 use \Psr\Http\Message\ServerRequestInterface as Request;
 use \Psr\Http\Message\ResponseInterface as Response;
 
 // AUTOLOAD UP SLIM
 require '../vendor/autoload.php';
 
$app = new \Slim\App;

 // DEFINE AN AUTH ENDPOINT ACCESSIBLE VIA POST REQUESTS
 $app->post('/auth/',function (Request $request, Response $response) {
   $allPostVars = $request->getParsedBody();
   if($allPostVars['username'] !== "shane@14oranges.com" || $allPostVars['password'] !==password_hash("superSecretPassword")) {
     $app->halt(403, 'Invalid Credentials.');
   }else {
     $token = password_hash ('SuperSecretToken');
     echo json_encode(array("status" => "success", "code" => 1, "token" => $token, "message"=> "App API Success" ));
   }
 });

// DEFINE A TICKETS ENDPOINT AVAILABLE VIA GET
 $app->get('/tickets', function (Request $request, Response $response) {
   if($token !== password_hash ('14Oranges')) {
     $app->halt(403, 'Invalid Token.');
   } else {
      $mapper = new TicketMapper($this->db);
      $tickets = $mapper->getTickets();
     $response->getBody()->write(var_export($tickets, true));
     return $response;
   }
 });
 $app->run();
 ?>

So there you have it. An Auth endpoint listening for username/passwordhash returning a token on success. A tickets endpoint sending back a list of tickets and verifying a valid token. All said and done very quickly. There are lots of useful features that I haven’t illustrated here but the documentation is good and the community is also pretty active so you can pretty easily find the answer you need.

Lots of handy helpers

Slim comes with a bunch of helper methods as well. Pretty self explanatory and easy to use. Here are a few examples.

$headers = $request->getHeaders();

$headerValueArray = $request->getHeader('Accept');

$contentType = $request->getContentType();

$mediaType = $request->getMediaType();

$charset = $request->getContentCharset();

$length = $request->getContentLength();

$parsedBody = $request->getParsedBody();

$body = $request->getBody();

My Findings

Slim is small, fast and easy to use. I would definitely recommend trying it out if you are developing an api. Keep in mind that Slim takes a barebones approach to development, though. The routing is basic yet functional, but relies on the developer being able to extend it. The Slim team realize this, and have made it easy to do so, notably with middleware and their use of Dependency Injection.

Templating is available too. Slim ships with support for Twig and PHP-View, but there are many other options as well. There are some very useful organizational tools such as route hierarchy and groupings allowing you to keep a complex API well organized.

I am not about to get Slim Framework tattooed across my back at this point but I know a few guys that might!.

[/read]

Nexus 5 to Nexus 5X Notification Sound Transfer

Just got a new Nexus 5X and set it up last weekend. To my surprise, all the notification sounds I was using on my Nexus 5 had changed even though they had the same name. I started googling around to see how to transfer them and didn’t find any single article on how to do so, so I decided to take upon myself to provide some instructions. I also promise that you won’t need to root your device or do anything that requires more geek brain cells than you currently have.

Before you start, here is what you will need:

  1. A Nexus 5X connected over wifi or data
  2. A Nexus 5 connected over wifi or data
  3. A dropbox account (note that Google drive or others could do) and the dropbox app installed on both phones. Login to your dropbox account on both phones. Now we use dropbox and wifi/data to transfer files on and off devices mostly for 2 reasons. 1. The Nexus 5X comes with a USB-C connector and I can’t find a USB-C to USB-A cable to be bought anywhere. All sold out or coming soon. My iMac doesn’t see my Nexus 5 when connected over USB for some reason.

And now the steps

Step 1 Getting the old files off your Nexus 5

  1. To transfer the sounds off your old Nexus 5, you need to access the /system/media/audio/notifications folder on your device. I’ve tried a few file manager apps and settled on the aptly named File Manager (not to be confused with the dozen other apps also named File Manager).
  2. Once you have File Manager installed, you need to make your way to /system/media/audio/notifications. Best way to do so is to click the little home icon at the top and then make your way to the folder.Screenshot_20151105-071240
  3. Once you are there, you will see a list of .ogg files which are the notifications sound files. Find the one that you would like to transfer. You can tap on it to hear it to confirm it is the one you want.
  4. Do a long press on it so that a little dialog comes upScreenshot_20151105-071421
  5. Select the Send option and then select “Add to Dropbox”. Select a dropbox folder and click Add.
  6. Wait a minute or so for Dropbox to do its synchronize.
  7. Go onto dropbox and rename the file to use a different name. I simply append “Old to the file name. So OldAriel.ogg for example.
  8. Migrate over to your Nexus 5X and start the dropbox app. Find the file you just put there Screenshot_20151105-074815
  9. On the right hand side, you should see a little down arrow. Tap on it
  10. Scroll (pan) down and tap the Export option and select Save to device. It should default to the Downloads folder. If not, make your way there.
  11. Tap Save
  12. Now for some reason File Manager doesn’t handle copying files to the Notifications folder properly. Likely a permission issue. You need to use this File Manager. Complete fluke I found this out actually.
  13. By default, that app presents a nice UI which doesn’t help you do much. Tap the hamburger menu at the top left and select Internal Storage
  14. Navigate to /root/sdcard/Download
  15. Find the file and do a long press on it until the list shifts to the right and the file has a checkbox beside it. Screenshot_20151105-073936
  16. Tap the dot menu at the top right and select Copy To
  17. Tap on Internal Storage
  18. Navigate to /root/sdcard/Notifications folder
  19. Tap OK. The file is now saved there.
  20. Go to your settings apps and select notifications sounds.
  21. You will now see two files with the same name. One of them is the stock notification, the other one will be the sound you just copied.
  22. Enjoy.

The 14 Oranges Guide to Planning a Mobile App

Introduction

Working in the App development field for the past 6 years, we have found that many of our customers come to us with an idea but have no idea where to start. We work to help them understand the process for developing their business and their app. App development, as with most businesses, starts with a market and an idea. Taking that idea and turning it into an app can be a daunting task. If you follow some basic steps in the planning process, it can be greatly simplified and much more effective for your audience.

The planning process begins with the Business Model, moves through to establishing app requirements and a minimum viable product and finishes with a phased plan to managing the project.

The words Apps - Where to Begin asking if you need help choosing the best app programs or software to put on your mobile device or smart phone, or how to develop applications

The words Apps – Where to Begin asking if you need help choosing the best app programs or software to put on your mobile device or smart phone, or how to develop applications

Business Model for Apps

We have many customers approach us with nothing more than an idea, most people don’t consider a business plan. You certainly do not need to have all the details (pricing, categories, options) sorted out, but when planning an app, you should consider how you intend to make money with it. You are more than welcome to create an app for philanthropic reasons, but we can’t all be Bill Gates so it’s imperative you think about how to make money from your app as one of the planning steps. Is your app going to be a paid for app, free, freemium, or a subscription service? There are multiple options to consider so let’s explore them below.

Mobile Apps Available for Purchase

The first and most basic model that was available on the various app stores was to provide apps for purchase. Users pay a one time fee (ranging from $0.99 to $999) to purchase the app with the bulk of apps being at the lower end of the spectrum. Now with that being said, Apple probably didn’t do anyone any favors by pushing the typical price of apps to be in the $0.99 range compared to the more typical $20 to $50 range that is very common for desktop apps. Now in some rare cases like Angry Birds, the $0.99 model worked like magic, but in general, selling apps for $0.99 can be very difficult considering that developing an app for a smartphone can be just as time consuming and costly as a desktop application. Moreover, with Apple and Google taking 30% of your proceeds, it makes getting a decent return on investment quite difficult. In order to make a $0.99 model work, your app idea must be earth shattering or you must be prepared to spend a huge amount of money on advertising to achieve global outreach and market wide penetration. Viral apps exist out there but those are few and far between and should not be counted on.

In App Purchases / Freemium

A variation of the straight purchase model is to offer the app for free (or even a small price) and offer additional features in the app as “In-App purchases”. Perhaps your app is restricted to a few records, a few basic features, and the more elaborate capabilities are offered for purchase. That model allows customers to pay for exactly the features they need and can maximize your revenues (if I recall my Microeconomics 101 course properly). The one factor to consider is that it can make testing the app a bit more involved as you have to test for all the different combinations of features. Once again, with In-App purchases, you are subject to the 30% store taxes.

This model is a very cost effective way to attract potential customers; however, be ready to expect somewhere in the 3% to 5% conversion rate for the paid features.

74_application management

Membership/Subscription Model

With most apps requiring some type of cloud service, one of the most effective revenue models is the membership or subscription model. In this model, users are asked to pay a monthly, yearly, and/or per consumption fee to use your app. With this model, you actually have two choices. You can rely on In-App purchases, allowing users to purchase items using the built in In-App purchase mechanisms provided by Apple or Google to pay for their subscription, but again at a cost of 30% to your bottom line. Another option to curb that “tax” is to create your own subscription service using one of the many payment providers (Stripe, Beanstream, Moneris). Now it does involve more work as you typically would need to include a website / user portal for users to manage their accounts and buy the service but that additional work/cost can quickly be recovered with the improved margins on your sales. One thing that you must be aware of is that in order for an app using your own subscription payment service to be approved by Apple, there must not be a single way for users to learn about and proceed with payment within your app. If there is a way, Apple will find it and your app will be rejected. They are quite good at protecting their revenue sources, which seems obvious given their staggering profits.

Basically, your customers will need to learn about your service outside of the app. The one exception to this rule is if the content they are subscribing to is consumed outside of your app. For example, maybe you are selling a gym membership within your app. The app acts as a point of sale but in the end, you are not using your app to consume your membership.

Advertising in your Mobile App

The last form of generating money from your app is advertising. Advertisers will pay to show their ads to your user base and there are a few ways to approach this scenario. One option that is quite popular with start up apps is to have a one or more ‘app sponsors’. When the app is being developed some of the costs can be offset by selling sponsorship opportunities. Often this will result in a banner type ad being placed in a prominent place within the app. These sponsors can be transitioned into long term advertisers once the app is live. A second approach to generating advertising revenue is to incorporate a third party advertising network into your app. These ad networks will automate the display of ads within your app, paying you for clicks or views of the ad depending on the arrangement. If your app is likely to generate lots of users and frequent use, this may be the optimal solution for you.

Some key factors when exploring Advertising Revenue Models are:

  • App traffic – how many users and how often will they use your app
  • Demographics – the more focused the demographics of your audience the more targeted the ads resulting in higher click through rates

Ad revenue can be a very effective method of generating money from your app, the rates for clicks or impressions are very low, all things considered, so the traffic needs to be there for it to make sense.

Requirements

After putting together your thoughts on the business model, the next thing to consider when planning out the app itself is the apps functionality. Creating a list of these requirements will be very helpful in scoping the work involved in completing the app. Software development can be extremely complicated and what might appear to be small features could actually involve hours of R&D.

One simple example of this would be time based triggers on iOS. For example if you want your app to perform a task every 15 minutes this would logically seem like a simple task. In reality, this is quite challenging to complete.

Here are some questions to ask when putting together your requirements list:

  • What platforms will be supported? (iOS, Android etc..)
  • What devices types will be support? (Phone, Tablets, Phablets)
  • Will the user need to login?
  • Will the app need to know the user’s location?
    • If so, how precise and how often
  • Will push notifications be required?
  • Will payments be accepted inside the app?
  • Will the project require a website?
  • Will the project require an admin panel?

If you are finding it difficult to write requirements, try sketching things out on paper, screen by screen or use a software tool like Balsalmiq to help you design this. This will help you visualize the pieces of the app from which the requirements will be derived.

flatUI_4_2

Minimum Viable Product (MVP)

Once you have created the requirements list for all the possible features to complete your dream app, it is important to be pragmatic and break out the Minimum Requirements to take your app to market. Time and money are the key factors at play. First Mover Advantage can be a huge factor in app rollout and defining an MVP allows you to get to market quickly while managing your costs.

Phased Approach

Most apps, once distilled, focus on a single concept surrounded by nice to have features that help manage and utilize the concept. Approaching app development using a phased approach has a slew of advantages.

Budget management is the obvious first advantage to a phased approach. If you develop the MVP and take the app to the market, you can often begin generating revenue which can then be reinvested to the features development.

Another advantage of a phased approach is the ability to build to your customers wishes. You can poll your user base, look at comments in the app store and build in the features your customers are asking for. Sometimes this will line up with your original concepts but often times the users will ask for things your team had not even thought of which is a fantastic way to connect with your customer base.

Adding features in a phased approach can also help with user engagement. Users can be notified of new features and that can bring them back into the app on a more steady basis. Many apps struggle to get users to come back to their apps on a regular basis so new features and updates can give users a reason to return.

Summary

Once you have worked your way through the planning process outlined above, you are ready to get started. Think about the business model, define your requirements, decide on an MVP and put a plan in place.  Don’t forget to reach out to your targeted customer base and ask them what features and ideas they want to see implemented in an app.  Most app users are tech savvy and would have some brilliant insight into your plan.  If you follow this simple process you will be ready to sit down with your development team and get the project underway.
If you need help or have questions during your app planning process, contact 14 Oranges. Or, if you need an app FAST (and we mean fast) see if our Info Grove service is right for you.

 

How to Use JSONKit for iOS and the Rotten Tomatoes API

Here is a short tutorial on how to use JSONKit and since it is best to have a tutorial with a real life example, we decided to show how to use it with the Rotten Tomatoes API. Now we know that using JSONKit is rather easy but we felt a tutorial could still help a few out there so here goes.

UPDATE: The article had a mistake. It used to say to use the objectWithData and objectWithString methods of JSONDecoder and should have said to use the NSData objectFromJSONData and NSString objectFromJSONString methods. Thanks to reakinator for pointing that out. The example project with source code had the correct API all along. The article has now been corrected. Apologies for the slip.

Preparation
Here are the steps you will need to do before getting started:

  1. Go to Rotten Tomatoes API site and apply for an account and a key. It is free to do so. Without a key, you won't be able to get responses from their API.
  2. Download JSONKit source code from Github

Note: We completed those steps with XCode 3.2.6 against 4.3 iOS SDK.

Using JSON Kit
Using JSONKit is super easy. What you need to do:

  1. Once you have downloaded and unzipped the zip file obtained in the preparation steps above, you will need to drop JSONKit.h and JSONKit.m in your project.
  2. Then import JSONKit.h" in your .m files where ever you need to parse a JSON response
    import "JSONKit.h"
  3. Whenever you have JSON data that you need to parse (more on how to get some later), you just use the objectFromData method like so

    NSData* jsonData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];


    NSDictionary *resultsDictionary = [jsonData objectFromJSONData];
    Alternatively, if you have your data in string form, you can use the following:NSDictionary *resultsDictionary = [jsonString objectFromJSONString];
  4. Once you have your dictionary, you can inspect it using the objectForKey method to get objects out of it.

Note: JSONKit is free but is licensed under BSD license or Apache License Version 2. Make sure to follow their licensing terms as specified in the source code.

Using Rotten Tomatoes API
[read more="Click here to Read More" less="Read Less"] The Rotten Tomatoes API allows you to do queries so you can obtain information about movies such as "year of release, runtime, cast, posters, audience scores, critics scores, reviews, and a slew of other data. Typically the steps to get what you want are

  1. Search for the movie name
  2. Find the movie in the list of results and get its id
  3. Do specific query using the id

Easy enough right? Let's see the details:

  1. Search for the movie name:
    You can use the http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=YOURKEY&q=MOVIENAME to make your search request (where YOURKEY is the API key you obtained in the preparation steps and MOVIENAME is the movie you are looking for. The response you will get should be something like:

    {
    total: NUMBEROFMATCHES
    -movies: [
    +{ … }
    +{ … }
    +{ … }
    ...
    ]
    +links: { … }
    link_template: "http://api.rottentomatoes.com/api/public/v1.0/movies.json?q={search-term}&page_limit={results-per-page}&page={page-number}"
    }

    Note that we "shrunk" the actual movie match details down to +{ ...} for clarity. To read this, you need to understand that NUMBEROFMATCHES is the number of results that you got. For example, searching for Toy Story, will results in 7 matches (Toy Story 3, Toy Story 2, Toy Story, Toy Story & Toy Story 2 in 3D Double Feature, so on).
    Now to make that request you would do it like so:
    NSString* theURL = [NSString stringWithFormat:@"http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=%@&q=%@",YOURKEY, SEARCHTERM];
    NSError* err = nil;
    NSURLResponse* response = nil;
    NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] init] autorelease];
    NSURL*URL = [NSURL URLWithString:theURL];
    [request setURL:URL];
    [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
    [request setTimeoutInterval:30];
    NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];Note: We chose to use a synchronous request here for simplicity. In reality, you likely want to use asynchronous methods so that your code isn't stuck on waiting for Rotten Tomatoes to respond.Now when you use objectFromData method to put that into an NSDictionary, any terms that have the answers right away, will be returned as an object.
    For example:
    id: 770672122
    title: "Toy Story 3"
    year: 2010
    Doing [resultsDictionary objectForKey:@"id"] would return an NSNumber with the movie id while [resultsDictionary objectForKey:@"title"] would return an NSString with the movie name. Similarly, you would get NSNumber for the @"year" key. Now the API sometimes return the year in quotes; therefore, you do need to test to see if the object returned was an NSNumber or an NSString. In the cases where the responses include a [, it means you are getting an array. For example:
    -movies: [
    Means that doing [resultsDictionary objectForKey:@"movies"] would return an NSArray of NSDictionary.
  2. Find the movie in the list of results and get its id
    Now finding the movie in the list will depend on your search criteria. We used the year to match. The code looks like this:
    NSString *aYear = yearField.text;
    NSDictionary *results = [jsonString objectFromJSONString];
    NSArray *movieArray = [results objectForKey:@"movies"];// Search for year to match
    for (NSDictionary *movie in movieArray)
    {
    NSNumber *year = [movie objectForKey:@"year"];

    if ([[year stringValue] isEqualToString:aYear])
    {
    NSNumber *ID = [movie objectForKey:@"id"];
    // Now use this ID for the next query
    }
    }

  3. Do specific query using the id
    Once you have obtained the id, you can then do another JSON request using the id. The URL will be of this form:
    http://api.rottentomatoes.com/api/public/v1.0/movies/MOVIEID.json?apikey=YOURKEY"

That's basically it. Rotten Tomatoes provides extensive documentation on their API here.

We are providing the code for this example here. Note that you will need to put in your API key at the top of RottenTomatoesJSONViewController.m class.

UPDATE:: We are doing an informal poll to see the iOS verstion distribution amongst our readers. Head over to our statistics post and let us know which version you are currently using. [/read]