Insights

Creating a Scooter Sharing App Like Bird, Spin and Lime

2 min readJordan Schuetz on Apr 30, 2018
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

With Project EON, you can create your own rideshare scooter application in just a few minutes and try to address this problem that is facing these emerging companies.

Electric Scooters have taken over the streets of San Francisco and other popular metropolitan cities. Recently there has been controversy surrounding whether these scooters cause a public nuisance and if the companies need to take actions to control where the scooters are allowed to be left by riders.

The city is willing to work with Bird, Spin & Lime since they want to see more green transportation methods come to the city. However, the process of leaving scooters on city streets is something that needs to be logistically fixed. Bird said publicly that it will begin to require riders to take a photo of where they drop off their scooters to take actions against vandals, however, it will have to be seen how the companies deal with the public outcry.

Electric Scooters

Spin Scooter left in a tree: Source: Kate Larsen @KateABC7

Create Your Own Scooter Share App

With Project EON, you can create your own rideshare scooter application in just a few minutes and try to address the problem that is facing these emerging companies. Each scooter in the fleet is an IoT device that sends GPS and location data to its servers so customers using the mobile application can see where the scooters are parked in real time.

Creating an infrastructure that supports thousands of simultaneous users is a huge challenge for most companies. If you are using PubNub however, all of those scaling issues are taken care of for you so you can focus on innovating your application.

Create Your Own Scooter

To get started, we are going to take a look at the Real-time Bus Map demo. In this initial code snippet, we initialize our PubNub keys and create our map. You have to setup your API keys through MapBox. Click the button below to generate your PubNub keys for Project EON.

var pubnub = new PubNub({ 
  publishKey: 'INSERT PUBNUB KEYS HERE',
  subscribeKey: 'INSERT PUBNUB KEYS HERE' 
}); 
eon.map({ 
  id: 'map',
  mbId: 'YOUR_MAPBOX_ID',
  mbToken: 'YOUR_MAPBOX_TOKEN',
  channel: 'scooterchannel',
  rotate: true,
  history: true,
  marker: function (latlng, data) {
    var marker = new L.RotatedMarker(latlng, {
      icon: L.icon({
      iconUrl: 'https://i.imgur.com/2fmFQfN.png',
      iconSize: [9, 32]
      })
    });
    marker.bindPopup('Route ' + data.routeTag.toUpperCase()); 	
    return marker; 
  } 
});

The code below is a publish function which publishes location information from each IoT device connected to the internet. Essentially each scooter would have this code running on the device, and would publish location information intermittently (can change time in the setInterval function).

var pubnub = new PubNub({
publishKey: 'INSERT PUBNUB KEYS HERE',
subscribeKey: 'INSERT PUBNUB KEYS HERE'
}); 
setInterval(function(){
  pubnub.publish({
  channel: 'scooterchannel',
  message:
    [
      {"latlng":[31,-99]},
      {"latlng":[32,-100]},
      {"latlng":[33,-101]},
      {"latlng":[35,-102]}
    ]
  });
}, 1000);

And that’s it folks! It’s really that easy to set up a scalable real-time location tracking application with PubNub and Project EON.

If you want to learn more and start building your first application, check out Project EON and PubNub. If you have any questions, reach out to me at schuetz@pubnub.com.

More from PubNub

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff