-
Notifications
You must be signed in to change notification settings - Fork 1
Setup
There are two ways to set up a project. Clone another similar project an throw out everything you do not need. Setup a clean empty project and add what you need. Both way have their pros and cons.
Throwing out code can be boring and it tends to be a bit weird. You are going to deal with code for which you do not have any interest. It is like tidy up a cellar room. But it works.
You will not miss any detail when starting from the scratch. Your write (or copy) the manifest, copy (and understand) each line of code e.g. to get a reference to a SharkPeer. It takes usually a bit more time but you will be more familiar with the system afterwards.
Either way leads to a running GUI for your application anyway. You choose.
- Create a fresh Android project.
- Add the latest release of the following jars to your project. How? Nearly same as adding an aar, see below.
- Add ASAPAndroid lib to your project to your project. It comes as aar file.
- Copy the latest version to the app subfolder of your project. (You might remove version number. It makes updates easier sometimes.)
- Choose File->Project Structure in Android Studio.
- Go to Dependencies .
- Press + to add a new dependency.
- Add an aar file.
- type aar file name, e.g. ASAPAndroid.aar (or ASAPAndroid_[version].[subversion].[minor].aar). Your app folder is considered to be working directory in this step.
You should find an entry
implementation files('ASAPAndroid.aar')
in your build.grade(:app) file. (You could actually add this line instead of going your way through studios menus.)
-
This step is optional. Copy all
uses-permission
lines from this AndroidManifest into yours. Those permission are already defined in the ASAPAndroid lib and will be inherated from your application. Sometimes it causes problems in either way. Your build process might fail due to a doubled declaration of permissions or something like that. In that case: Remove thoseuses-permission
lines from your manifest again. -
Declare our ASAPService in your manifest file by adding those line (can also be found in this AndroidManifest)
...
<service
android:name="net.sharksystem.asap.android.service.ASAPService"
android:enabled="true"
android:exported="true"
/>
...
- Add a single empty Activity. Do not forget to add it to your manifest beside our ASAPService. Build and run your application. You have succeeded if your (empty) Activity launches.
Our main objective was implementing a developer framework but no application. We needed an application as a beacon. We needed a non trivial application that leverages all features of our developer framework. This application helped to shape the API. This application is not meant to be good looking (it is definitely not) or even fully tested (it is not). It proofs to things: 1. Our developer framework works. 2. We can implement an application with it.
That application is SharkNet2Android.
Here are the steps:
- Clone it.
- Remove all unit tests and Android tests (if there are any). You can write your own.
- Remove all src packages but sharknet/android.
- Remove settings subpackage.
- Remove all resource like layouts, menues, string etc.. You do not remove the folder but the resource files only.
- Add (if not already present) the latest release of the following jars to your project:
- Add (if not already present) ASAPAndroid as android component to your project. Have a look at AndroidService build.gradle and settings.gradle
- Remove all activity descriptions but InitialActivity from manifest file.
- Try to build the systems. Throw out what makes problems. (Remaining code under sharknet/android will make trouble. Some of it requires the SharkPKI jar. Add it if you plan to use encryption Comment out anything that makes trouble in the code. This code might come in handy as template when you start implementing your own GUI.) Repeat this step until your project can be build. (It is like tidy up a messy room. I am sorry. But it will lead finally to success).