Showing posts with label sdk. Show all posts
Showing posts with label sdk. Show all posts

Sunday, January 31, 2016

7 Parse alternatives or Parse It Yourself

Last Friday it was a bit disappointing to find out that Parse will discontinue its services. It used to be my favorite mBaaS as it was perfect for prototyping but also suitable for production data. It is a scalable solution, it has great documentation and is easy to use.

Many mobile developers of iOS and Android apps rely on the Parse backend system for data storage and push notifications. The fact that Facebook has decided to discontinue it is a bit surprising as they did put a lot of effort in supporting Apple TV (tvOS) and Apple watch recently.

What is Parse actually?

Parse is a mobile Backend as a Service (mBaaS) that uses a MongoDB database to store data and Amazon S3 to store files. The Parse SDKs for Android and iOS include handy stuff such as caching and uploading data and files in the background. Other features are analytics, push notifications and cloud code, which is useful for the integration of mail and SMS functionality for example.


If you want to create a new app using a mBaas right now there are some interesting alternatives. But if you do have an app that currently is using the Parse SDK probably your only option is to use the Parse Server. Here is a tutorial to find out what you need to keep your app running on the Parse technology. Or have a look on Github where the source for the Parse Server is hosted.

Some of the features supported by the Parse Server:
  • CRUD operations
  • Schema validation
  • Pointers
  • Users
  • Installations
  • Sessions
  • Roles

Some of the not or not fully supported features:
  • Push notifications
  • Facebook login
  • Web based dashboard

It cannot be too difficult to reanimate most of the Parse functionality using the recently published open source Parse Server. And that is what The distance has planned to do. Well, more or less. They have plans to offer hosting for the Parse Server.

7 Parse alternatives

1. Back4App

Updated Back4app is a new mBaaS for building and hosting Parse APIs. It comes with a migration plan for your existing Parse solutions and it looks very promising.

2. Firebase

Firebase is a scalable real-time backend for your web app.

3. BAASBOX

BAASBOX is an open source backend for your mobile app. It has SDKs for iOS, Android and Javascript.

4. Quickblox

QuickBlox is about building blocks for a backend infrastructure. Offers data storage, push notifications, text and video chat, and many other features.

5. Azure

Microsoft Azure comes with support for push notifications and other mobile services. Since the platform is here to stay you could consider to use Azure to store your new Mongo DB and the Parse server.

6. Backendless

Backendless provides an instant mobile Backend as a Service and overall application development Platform.

7. Pubnub

PubNub is a real-time network that enables software developers to rapidly build and scale real-time apps by providing the cloud infrastructure, connections and key building.

Conclusion

It was only in 2013 that Parse was acquired by Facebook. Using a mBaaS for prototyping purposes is great but you can not (fully) rely on it, even when big names are involved with them or should I say in particular when big names are involved?

We will miss Parse but not for a very long time I guess. There are plenty of alternatives and releasing the Parse Server as open source might come with some new and interesting opportunities.


Further reading

Monday, December 7, 2015

App of the rings: Neyya, Android SDK and BLE

My great friend Wim Wepster gave me this interesting Neyya ring. Fortunately it did not come with a proposal. Instead it was a great opportunity to explore Bluetooth and alternative wearables, such as this ring.

Neyya is a ring that can send gestures such as taps and swipes to a mobile or another device that is supporting BLE. You can use it for presentations or games, although you can just use your mouse, watch or phone for that as well. So I wondered how it works and what could be an interesting use case for it.

Neyya comes with an iOS and Android app but also with an Android SDK. I was having some troubles with it as it was not able to detect my Neyya ring at all. For the time being (as there must be a more elegant solution for it) I have fixed this by modifying the NeyyaBaseService class within the NeyyaAndroidSDK project.



I removed the check to determine whether the Bluetooth device is a Neyya ring or not from the onLeScan method.

 private BluetoothAdapter.LeScanCallback mLeScanCallback =
   new BluetoothAdapter.LeScanCallback() {
     @Override
     public void onLeScan(final BluetoothDevice device, int rssi,
       byte[] scanRecord) {
         String deviceAddress = 
           device.getAddress().substring(0, 13);

         // if (neyyaMacSeries.equals(deviceAddress)) {
              NeyyaDevice neyyaDevice = new NeyyaDevice(
               device.getName(), device.getAddress());
              if (!mNeyyaDevices.contains(neyyaDevice)) {
                   logd("Device found - " + device.getAddress()+ 
                    " Name - " + device.getName());
                   mNeyyaDevices.add(neyyaDevice);
                   broadcastDevices();
              }
         //}
     }
  };
I did the same thing for the isNeyyaDevice method, like this.
public boolean isNeyyaDevice(NeyyaDevice device) {
  String deviceAddress = 
    device.getAddress().substring(0, 13);

  /* if (!neyyaMacSeries.equals(deviceAddress)) {
       logd("Not a neyya device");
       broadcastError(ERROR_NOT_NEYYA);
       mCurrentStatus = STATE_DISCONNECTED;
       broadcastState();
       return false;
     }
   */
    return true;
  }

Okay, I have to be more careful which Bluetooth device I pick from the list of available devices but at least I am able to continue my journey. Let's connect to the device.


Great! but what is it that we are trying to solve here?

The supported gestures are taps, double and triple taps, swipe left, right, up and down. Now, what problem could this ring solve other than the things that come with the Neyya app already, such as capturing a picture, turning the volume of a device up and down and moving to the next or previous song?

One of the problems that the Neyya ring could help me with is something that most people will recognize. Your best ideas come up when you are not able to write them down immediately, for example while taking a shower or driving a car. In such cases it would be great to just rub your ring to create an audio note. That is easy to implement.

To create a prototype I have modified the ConnectActivity class a little. First in the onReceive method of the BroadCastReceiver implementation I do call a new method actOnGesture

 ...
 else if (MyService.BROADCAST_GESTURE.equals(action)) {
   int gesture = intent.getIntExtra(MyService.DATA_GESTURE, 0);
   showData(Gesture.parseGesture(gesture));

   actOnGesture(gesture);
 ...

That method goes like this

    private String actOnGesture(int gesture){
        Gesture.parseGesture(gesture);
        switch (gesture) {
            case Gesture.SWIPE_UP:
                stopRecorder();
                return "SWIPE_UP";
            case Gesture.DOUBLE_TAP:
                startRecorder();
                return "DOUBLE_TAP";
        }
        return "";
    }

To start recording we will create a MediaRecorder instance and create an output file for it in the m4a format. in the stopRecorder method we will stop the recording.

   private static String mFileName = null;
   private MediaRecorder mRecorder = null;

   private void startRecorder() {
        if (mRecorder!=null){
            return;
        } 
        String timeStamp = "/" + System.currentTimeMillis() +
          ".m4a";
        mFileName = Environment.getExternalStorageDirectory().
          getAbsolutePath();
        mFileName += timeStamp;
        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(
         MediaRecorder.OutputFormat.MPEG_4);
        mRecorder.setOutputFile(mFileName);
        mRecorder.setAudioEncoder(.
         MediaRecorder.AudioEncoder.AAC);
        mRecorder.setAudioSamplingRate(16000);
        mRecorder.setAudioChannels(1);
        mRecorder.setAudioEncodingBitRate(16);

        try {
          mRecorder.prepare();
        } 
        catch (IOException e) {           
        }
        mRecorder.start();
    }

    private void stopRecorder() {
        if (mRecorder==null){
            return;
        }  
        mRecorder.stop();
        mRecorder.release();
        mRecorder = null;
    }

Do not forget to add the right permissions to the AndroidManifest.xml file before you test the app.

  <uses-permission 
    android:name="android.permission.BLUETOOTH" />
  <uses-permission 
    android:name="android.permission.BLUETOOTH_ADMIN" />
  <uses-permission 
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission 
    android:name="android.permission.RECORD_AUDIO"/>

As soon as the app is running and the ring is connected, double tap on it to start recording and swipe up to stop the recording. You can use an app, such as the Astro app, to locate and play the audio file that you have recorded.


Conclusion

Later I will release the code of this POC on GitHub. I need to work out the concept a little bit more. Anyway, I am not fully convinced yet whether the Neyya ring is a useful wearable device or not, but by examing the code I have learned something about Android and Bluetooth and I do have a memo recorder that I can use just anywhere now.

Do not forget to take your phone with you as well, wherever you go. Wait for my first shower-voice-memos to arrive ;) Of course you can use the ring plus app as a spy tool if you want or find other purposes for it. My precious...

Further reading