Good news! We’ve added support for developing on mobile devices! 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.
Downloading the APK
You can get the SAFE Authenticator App (POC) from the GitHub Repository.
Before installing the APK
If you have the older version on there already you’ll need to take it off first.
You’ll need to make sure that your phone/device has permission to install third-party apps.
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).
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.
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
What’s the situation wrt iOS development? I know someone who may be interested in SAFE for an existing iOS app so want to check before contacting them.
Application development for iOS devices can be done using Xamarin using the SafeApp C# package on nuget. For authentication to the Alpha-2 network, the developer can build and run the SafeAuthenticator application from this repository on an iOS simulator / registered development device.
Are there instructions on how to use a native Java library, rather than the one including the Android dependencies?
From looking at the code in https://github.com/maidsafe/safe_app_java under api, it isn’t obvious that there are any Android libraries needed. However, when I try to build the library, it is asking me for Android SDK, agreed Android licenses and so forth.
Ideally, I’d like to be able to use JitPack to just build a jar that I can use in my Java project, until there is any formal Maven Central package that I can include.
I understand that Android may be the destination, but core Java support should be on-route. Has anyone been experimenting with this?
The api and lib jars will be created in safe_app_java/api/build/libs and safe_app_java/lib/build/libs.
The shared native libs will be in safe_app_java/safe-app/.tempDownloads.
Thanks, @ogrebgr - that is exactly what I needed! Are these things obvious from the build.gradle or some such? I’ve not really used gradle much in anger.
I am working on proof-of-concept mail/chat app. Currently at the stage of creating simpler API around NativeBindings. Will need few more weekends until having something to show…
Hi all - just working my way through the tutorial app. I keep getting stuck here. I’m guessing that when I was asked to include dependencies (alt-enter followed by a choice of two options) I picked the wrong one. I can’t see an obvious way back though. Bearing in mind that I haven’t the first clue what I’m doing, what’s the next step?
You probably autoimported ContainerPermissions from safe_authenticator, not the regular. Go on top of the file, find import net.maidsafe.safe_authenticator.ContainerPermissions;, remove it, and then import the regular (i.e. the one without safe_authenticator in its name).
Thanks @ogrebgr - got me onto the next stage at least. I’m now stuck here - lots of symbols can’t be resolved. I notice the connect() method takes different arguments in SafeTodoService.java template from @lionel.faber’s video (8:30, lower image) so presumably it’s been updated. Could that be the issue? I’ve tried clearing the cache and restarting - no joy.
Thanks for any help.
Open build.gradle (app). There is:
mockImplementation ‘net.maidsafe:safe-app-android-dev:0.1.0-SNAPSHOT’
nonMockImplementation ‘net.maidsafe:safe-app-android:0.1.0-SNAPSHOT’
Hit Alt-Enter on each to be changed to latest version, sync and errors should be gone.
Hey @JPL. Looks like you’re updating the connect function in the SafeTodoService class. The code from the tutorial should go into the SafeApi class’ connect function.
With regard to the dependencies, the SNAPSHOT libraries will contain the latest version of the code from the master branch. This is a pre-release that devs can try out before an official release of a new version on jcenter. So for example, if you raise a PR ( ) with a bug-fix / improvement that gets merged into the repo’s master branch, an updated version of the library will be available on the OSS-SNAPSHOT-LOCAL repository as safe-app-android:0.2.0-SNAPSHOT so that other devs can start trying it out before the official release on jcenter.
In @JPL’s case the dependencies are specified without the -SNAPSHOT prefix so the additional repo link will not be required.
OK, getting there. One step at a time … Pretty sure I’ve updated the right class this time (doh), but I’m getting the ‘cannot resolve symbol’ error again.