-
Notifications
You must be signed in to change notification settings - Fork 1
Home
A little movie gives an overview what you had to do to use ASAP - and what you would gain in return (German / English).
Your first job is to design your application.
Most important: Your application is decentralized. You applications consists of independent parts - call them peers. Each can store its own data and can decide when (and where) it is willing to interact with others.
That own will has its limitations, though. A little sensor in an IoT application won't have a sophisticated rule set of access rights. But even such a device could have a black/white list or rules to whom it send what kind of data (complete data set, a summary, ..)
Anyway: Your app is made up of peers that exchange messages. That's your general pattern.
Peers and (human) users can and should be seen as a unit in a lot of application classes. It can be taken literally when it comes to smartphone apps. User can move and switch on and off their phones as they please.
Do not even think of introducing some kind of super-peer into your design. There cannot be peers, which are always reachable, always online, collects all or a lot the data. An entity that cannot do any work without another one is no peer.
Features of a peer are:
- Autonomy: It can move (or be moved - mobile phone). It can go on-/offline at any time.
- Data exchange is message exchange: Any communication comes down to asynchronous message exchange. Never assume a stable communication stream to any part in the system. Do not assume high bandwith.
- There is no central site if you write a pure decentralized system. There is no centralized database, that collects all the data or keeps track of exchanged data. There is no central archive. Decentralized systems are very good in forgetting. Single peers can have a good memory. But the whole system has non.
(My personal impression: We barely call apps WWW apps or even World Wide Web apps. But the vast majority of apps are. There are servers offering services with some variant of an HTTP API. That's ok. It is WWW. No shame. It is an architectural model that was considered vulnerable even in the 1960th. Who cares ;)
They are called Internet apps in common speech instead. Sounds cooler doesn't it. It is not earned, though. Internet is a decentralized network - most apps are not. You are going to implement an Internet app. The irony: If you stick to ad-hoc networks: You will not use Internet at all.)
You made a big step when you designed your application that way. It differs to the usual design in the beginnings of this century. It is more a real Internet application and less a WWW applications - it is decentralized.
The final steps are handcraft.
- Define you data structures.
- Define what happens if peers encounter. What do they exchange. How do they react on received messages.
- Most apps consists of sub-applications. A messenger usually consists of a message exchanger but also a part that exchanges personal information to manage the contact list. Separate different parts of your app. It becomes much easier.
Now, you are ready to implement. There is no advice for GUI design here. In terms of MVC: This lib helps to implement model and control. It makes any communication for you.
Now, have a look at Implement an Android ASAP application.
If you like, have a look in our more complex ASAP based messenger SharkNet2 (which is and probably will always be work in progress).
Very important: permissions. Please, add permission in your manifest file, e.g. like this
<!-- ASAPEngine needs to write in files -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- ASAP requires networks access ->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- if you plan to use Wifi direct -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- if you plan to use Bluetooth -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
This movie shows how to set up Android Studio to become ready for a new ASAP. application.