Release of Platform Development for Android


#1

Good news! We’ve added support for developing native Android apps! We’re starting off by releasing an API, an updated mobile SAFE Authenticator (POC) to use this new API, and a tutorial that will allow you to carry out native Android development. We’re pretty excited about this, and hope you are too, because for the first time, everyone now has the ability to develop DApps for mobile devices! And if you’re a developer in the decentralised scene today, you’ll know that this isn’t something that’s available in many other places.

So what does this release give you?

SAFE Authenticator for Android

First things first - anything you develop will need to get authorisation to access the SAFE Network so we developed a SAFE Authenticator app for Android. The SAFE Authenticator acts as a gateway to the SAFE Network by enabling users to create an account & authenticate themselves. It ensures users have full control over the permissions they grant to SAFE apps on their mobile device. Currently it’s a proof-of-concept (POC) we have on GitHub but after a few changes it will be downloadable from the Google Play Store in the near future.
Screenshot-20181210-161457.jpg
You can get the SAFE Authenticator App (POC) from the GitHub Repository.

A quick word on installing the APK

  • If you have the previous Authenticator POC installed on your device you’ll need to remove that first.
  • You’ll need to make sure that your phone/device has permission to install third-party apps.
    You can make sure this is checked under the “Security” tab within your Settings menu.
    Normally it’ll say allow third-party installations or install from unknown sources. Then you can download and install the SAFE Authenticator App (POC) on the device.

Getting connected to the Network

Just in case you need to register (or update) your IP address to access the SAFE Network then here’s a quick reminder:

  • Log in to the forum on your normal browser (you’ll need to have Basic Trust Level 1).
  • Visit https://invite.maidsafe.net.
  • Click on the SAFE Network logo.
  • Select the Alpha 2 network.
  • Click on the button to register or update your IP address - if the IPs are the same then ignore this step.
  • Click on the clipboard icon to copy the invitation token.
  • Paste the invite code into the Invitation field on the Authenticator.

Building an Android application for the SAFE Network

You can now learn how to build a native Android application for the SAFE Network. For this you’ll need Android 7.0 Nougat (API 24) as a minimum. To help you along the way, we’ve also added a tutorial that walks you through the process of building a simple to-do list application.

Android-Getting-Started.png

See the tutorial on DevHub

API Documentation

If you’re looking to build quality mobile applications then having good documentation is a must to guide you along the way. So, in addition to the existing Node.js API documentation, we’ve released a new Java API for developing on Android.

Android API - Java

DevHub - Docs page

Finally, all the main documentation can be accessed from a new ‘Docs’ page on DevHub so you’ll always have a central point of reference that you can return to.
Dev-Hub-Page.png

Currently this contains links that will help you learn more about:

  • Platform Development:
    • Node.js
    • Java (Android)
  • Core Development:
    • Rust

Summing up

If you’re not a developer, it’s probably worth restating - this is another significant step forwards for the SAFE Network community. Everyone knows how much of the world accesses the internet using a mobile device as the primary platform - and that percentage is only growing over time. With these first releases, we’re taking some early steps toward enabling developers around the world to build distributed apps that are mobile-first and ready for the future. We can’t wait to see what you build!


SAFE Network Dev Update - January 10, 2019
List of Websites/Safesites & WebIDs (Community Resources)
#2

@maidsafe what about iOS?


#3

Starting 2019 off with a bang.
Awesome leap for the network.


#4

My tablet is Android v5 :frowning: and my phone v4.4 :frowning_face:

Admittedly both are long in the tooth.


#5

Currently we also support developing cross platform applications for Android and iOS using Xamarin via the SafeApp C# package. :slight_smile:

You can find more information in this thread.


#6

In this regard I would suggest using the wording “We’ve added support for native android apps” instead of “We’ve added support for developing on mobile devices!”

However, great work! :slight_smile:


#7

Fantastic work, guys! This is a great step forward, especially considering how many people use android phones and tablets as their primary devices.

A quick side question, for something like a chat app, would it cost credits to send direct messages? I am just wondering whether there is a potentially useable app even on alpha 2/3.


#8

Fyi, you need to delete the old alpha poc mobile authenticator before installing this one, I think. Mine failed to install until I did this.


#9

Yes, writing would cost credits. Similar example can be found here in the csharp email app: https://github.com/maidsafe/safe-email-app-csharp

… or in the chat app that I wrote some time ago (now outdated due to API changes): https://github.com/Mindphreaker/mind2chat

Currently you need to write the message to the network and then pull for new messages on the receiving side. Maybe this might change with the secure messaging layer.


#10

I’ll edit the OP, Paul to take account of that - thanks.
DG


#11

Took the words right out of my mouth. Boom!


#12

Nice work and super good looking presentation of the release, very well done! :tada:


#13

That’s a fair point, @Mindphreaker, esp when it’s kind of the point of what we’ve launched.
Consider your suggestion taken on-board and yet another edit to the OP by me on the way.
DG


#14

Can anyone from the team comment on the possibility of using React Native to create Android apps for SAFE?

I’ve been poking around with React-static and the whole thing looks good. I like the idea of a common codebase based on JS/nodejs/JSX/React Components that can target browser, desktop (Win/Mac/Lin) and mobile (Android/IOS) and React just might be it!


#15

It’s certainly possible to do develop x-platform with react/native @happybeing . Though I think in reality the complexity may outweigh the benefit. (Caveat: I never tried react native though, so this is aaaaallll hearsay :stuck_out_tongue:)

AirBnB was blazing a trail with react native, and contributing actively to it (as far as i remember from an article… somewhere :expressionless: )but they’ve moved away from it in the last 6 months to separate native/web apps.


#16

I looked into React Native for SAFE a while back. It sounds feasible but would require developing a native bridge layer for the Android and iOS SAFE APIs.

Another potential common codebase solution might be: https://flutter.io/
It’s very young but looks pretty impressive.

Out of the box it supports Android and iOS, but it can also be used to build desktop apps: https://github.com/google/flutter-desktop-embedding, and soon web apps as well: https://medium.com/flutter-io/hummingbird-building-flutter-for-the-web-e687c2a023a8

Google’s new operating system Fuchsia implements its UI and apps using Flutter, so it is likely to stick around for a while.


#17

Thanks @joshuef and @tmark. I’m still very green on these areas so find these comments useful.

I found this article comparing Xamarin, React Native and Flutter very good too:

I shall continue exploring ReactJS/React-static for Solid on SAFE in the browser for now.

I didn’t find anything about writing a bridge for React Native yet so don’t know how tricky that would be. As we already have ffi bindings, maybe it’s not out of the question? I like the simplicity and modularity of ReactJS a lot, and React-static seems to keep that while providing a very easy route for creating Web apps. If components from there could easily be utilised on mobile I think it will be interesting, and quite a good way of adding support for mobile too an existing project, initially developed as a Web app.

What’s also nice with React-static is that I think it will be possible to target clearnet and SAFE, and to generate very performant websites for both in one go, during that period when people are straddling both clearnet and SAFE. Or want to target clearnet, but be ready for SAFE when it takes off. :slight_smile:


#18

@happybeing - here is some info about RN bridge from the source: https://facebook.github.io/react-native/docs/communication-ios

This bridge essentially makes it possible to call into native Android/iOS code from JavaScript and get a response. On Android, it would be a bridge between JavaScript and Java, on iOS between JavaScript and Objective-C. From the native code, the calls would then be forwarded to the SAFE API, via the new Java API on Android and FFI on iOS.


#19

Yes maybe long in the tooth, but I kinda feel that SAFE needs to be able to run on previous versions of the devices. Its perhaps an unfortunate fact that the poor amongst us who cannot be using the latest versions of the OS on their devices. Hand-me-downs etc is the main cause.

Also the less technical often use their devices a lot longer than the OS cycle. And some who just don’t upgrade unless its essential.

So in my opinion SAFE devs will need to ensure the software runs on as many previous versions as is reasonably possible in order to be as inclusive as possible. After all it has been said that they want to get SAFE into the hands of the poor as much as anyone else.

@Traktion, said “direct” chat which has also been used to denote one where the conversation is setup in SAFE and then the 2 APPs talk IP to IP directly and not requiring SAFE PUTs for the delivery of the chat messages. Just as in a phone call setup in SAFE


#20

I guess Xamarin apps would use this same authenticator? Does anyone have comments on why to choose this package over Xamarin apart from preferring Java to .NET? Xamarin seems to have the advantage of being cross platform.