##Library for integrating shareware functionality.
ShareAware is a mobile software library supported on Android and iOS devices. Its allows the app developers to implement capabilities in their app to exchange content between users. The library first allows users to establish trust before exchanging any content.
It allows to exchange artifacts, tokens with each other when application users are connected and in proximity of one another. Connection between two such user or players is secured via simple means of authentication pin exchanges (like bluetooth). This is useful for applications/games which can peer with another user or player and allow each other to interact as long as the two (user/player) are connected with each other.
The concept of sharing content has been around in many devices such as Nintendo DS. But, in mobile apps, it's still not available. Many commercial use cases such as lending in-app content for a short period are possible with this application. A complete commerce eco-system can also be built by developers within their app to increase referral and monetization opportunities.
This library is available in [Android] and [iOS]. Usage of each is explained below.
Contact developer for any further details on new and on-going improvements and development in progress and help if needed to integrate or commercialize this feature.
The sample is a means to explain the core and basic functionality of this library. Think of it as an application or game which has a few resources (artifacts) that can be shared or gifted to a partner or player or fellow-user. The resource or the artifact could be
- Document that can be shared with due tokens and viewed or edited.
- Functionality of an application which otherwise is available only to one user or player as opposed to other.
- This functionality or access or privilege can be obtained depending on the intended use of the application or game itself. It could come after reaching a certain level or loyalty or user having had to pay for this.
The sample app has a list of buttons which light up when the user has paid for this. So, the sample app can work as the 'Paid' version as well as the 'Free' version. You can view the differences when chosing this radio button or the SegmentedControl (as the case may be).
Sample App - Free | Sample App - Paid |
---|---|
In the sample app, the 'lit up' (enabled) buttons simply show a dialog if/when they're enabled (if not - they're greyed out). A button is 'lit up' (or enabled) either by default in the Paid version (because the user has paid for it or earned it) or it was requested for by the Free version and allowed by the Donor or Benefactor (the Paid version).
Sample App - Paid | Sample App - Paid |
---|---|
The sample also demonstrates the use of the share functionality by a Menu or Button to find peers in the same WIFI network. Upon finding appropriate peers - the two user or players can connect with each other using simple PIN based authentication mechanism.
Share UI - Free | Share UI - Paid |
---|---|
Once the two user or players are connected with each other. The benefactor (the Paid version or the one having these functionalities) can share or allow (or deny) requests coming from the other user.
ShareUI - Paid | ShareUI - Paid |
---|---|
Upon receiving grant requests or allowed by the benefactor or paid version of the application - the free-version now is able to realize the same as long as the two are connected or until either one of them revokes or returns the resource.
ShareUI - Free | ShareUI - Free |
---|---|
Exiting the Share UI and going back to the application the free user will see the buttons 'lite up' and the paid user will/can continue to use the same functions as before
Sample App - Free | Sample App - Paid |
---|---|
![Sample App - Free ] (https://raw.github.com/ShareAware/shareawarelibrary/master/iOS/screen-shots/SampleApp-Free-Req-Granted.png) |
Upon returning to the app and context - the real features can now be consumed by both the free and paid version.
Sample App - Free | Sample App - Free |
---|---|
The library uses UI functionality hence is packaged and bundled (and some needs for integration) are elaborated below.
The android library is built as a library which would need to be referred to by the application intending to use this functionality. All resources and core functions neccessary for the library to function are encapsulated in the android-library code. As seen from the git bundle - there're two projects -
- android-library: This is the core library containing the functions, classes and resources neccessary for the library to work.
- android-sampleapp: This is the sample app demonstrating its use
-
git clone https://github.com/ShareAware/shareawarelibrary.git
-
eclipse - 4.1 w/ ADT
-
Import Library
-
There is a dependency which will be removed in ensuing versions on ActionBarSherlock (https://github.com/JakeWharton/ActionBarSherlock). Pls Remember to import ActionBarSherlock and re-do the Library settings to point to current project in Eclipse
-
Import SampleApp
-
Build and Run on two devices
-
Check out MainActivity and how it is launching the Library - follow similar steps in your own app.
-
Need to have two devices/apps working on the same WIFI network.
-
SampleApp has two versions
9.1) Paid
9.2) Free
-
Same/sample app can be run as Paid and Free versions on two diff devices.
-
Share->Start on both devices
-
Connect on finding each other - use any char/num as PINs to connect/authenticate with each other.
-
Request/Revoke functionality of Paid versions to the Free version
-
Observe the functionality (for now abstracted as simple buttons) being shared by Paid version of the app w/ The Free version
launchLibrary - can be called from a Menu/button as needed.
/**
* Method to launch the Share library
**/
void launchLibrary() {
Handler uh = new Handler(MainActivity.this.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (msg != null) {
String name = msg.getData().getString("name");
String permission = msg.getData().getString("permission");
String sharedWith = msg.getData().getString("sharedWith");
updatePermission(name, permission, sharedWith);
Log.i(TAG, "Message from Library: " + name + ", " + permission + ", " + sharedWith);
}
}
};
ShareWareLibrary swl = new ShareWareLibrary(uh);
swl.setIsFree(MainActivity.this.isFree);
swl.setShareWareArtifact(MainActivity.this.artifactsArray);
swl.launchUI(MainActivity.this);
}
/**
* UpdatePermission - callback from the library handler
* @param name - Name of artifact
* @param p - Permission
* @param s - Shared with
*/
void updatePermission(String n, String p, String s) {
Log.i(TAG, "updatePermission: " + n + ", " + p + ", " + s);
int ii = 0;
ShareWareArtifact tSWA = null;
for (ShareWareArtifact swa : this.artifactsArray) {
if (swa.name.equals(n)) {
swa.permission = p;
swa.sharedWith = s;
tSWA = swa;
break;
}
ii++;
}
if (tSWA != null) {
artifactsArray[ii] = tSWA;
}
ii = 0;
for (Button button : featureArray) {
button.setEnabled(artifactsArray[ii].permission.equals("true"));
ii++;
}
}
iOS library is built as a Static framework library. Since the library uses UI - some steps are necessary to import/add these resources over - as explained below.
- git clone https://github.com/ShareAware/shareawarelibrary.git
- XCode - 6.1
- Sample App- #import "ShareWareLibrary.h"
- Target - SampleApp
- Build Phases
- Link Binary w/ Libs
- +, Add Other
- Pick the folder where you downloaded the iOS libraries containing the resources (storyboard), libraries and .h files.
- Copy Bundle Resources (storyboard and .h) - pick all under include/ShareWareLibrary
- Build and Run on two devices
- Check out Main ViewController and how it is launching the Library - follow similar steps in your own app.
- Need to have two devices/apps working on the same WIFI network.
- SampleApp has two versions Paid, Free
- Same/sample app can be run as Paid and Free versions on two diff devices.
- Share->Start on both devices
- Connect on finding each other - use any char/num as PINs to connect/authenticate with each other.
- Request/Revoke functionality of Paid versions to the Free version
- Observe the functionality (for now abstracted as simple buttons) being shared by Paid version of the app w/ The Free version
''' // This will launch the Library
-
(IBAction)handleShareButtonItem:(id)sender { _shareWareLibrary = [[ShareWareLibrary alloc] init]; _shareWareLibrary.isFree = ([self.isFreeOrPaidSegControl selectedSegmentIndex] == 0); _shareWareLibrary.sDelegate = self;
_shareWareLibrary.artifactsArray = _artifactsArray;
[_shareWareLibrary launchUI:self]; }
#pragma mark - ShareWareLibraryDelegate delegate // This is an implementation of the Delegate which is called when permissions are involved.
- (void) updatePermission : (NSString *) key : (NSString *) value : (NSString *) sharedWith { // Don't mess unless its free if ([self.isFreeOrPaidSegControl selectedSegmentIndex] == 0) { NSLog(@"updatePermission: %@, %@", key, value); int idx = -1; int ii = 0; ShareWareArtifact *tSwa = nil; for (ShareWareArtifact *swa in _artifactsArray) { if ([swa.name isEqualToString:key]) { swa.permission = value; swa.sharedWith = sharedWith; idx = ii; tSwa = swa; break; } ii++; } if (idx > 0) { [_artifactsArray replaceObjectAtIndex:idx withObject:tSwa]; // [self.artifactsTableView reloadData]; } [self viewWillAppear:TRUE]; } }
'''
[Android] : https://github.com/ShareAware/shareawarelibrary#android