Download the cloud4apps library from the following link:
https://sourceforge.net/projects/cloud4apps/files/
Extract the zip file to your working directory
Import the cloud4apps library and sample app from Eclipse
Create a new Android project or open your existing project
In the Package Explorer, right-click your project and select Properties.
In the Properties window, select the "Android" properties group at left and locate
the Library properties at right.
Click Add to open the Project Selection dialog.
From the list of available library projects, select cloud4apps.SDK and click OK.
Using The Translation Services
Navigate to
your apps
Find the App Version you want to consume resources from and click on it
Copy the [Version Key] and paste it into a constant in your code as shown below:
// Edit these values from:
// https://www.cloud4apps.com/Translation/Translate?versionKey=your_app_version_here&targetLanguageCode=en
String versionKey = "your_app_version_here";
TextView text2 = (TextView) this.findViewById(R.id.text2);
String helloCloud = cloud4apps.Localize.ResourceUtils.getString(this, versionKey,
R.string.helloCloud);
text2.setText(helloCloud);
Consuming the Payments & Licensing System:
Navigate to
your apps
Find the App Version you want to consume resources from and click on it to obtain the [App Key]
Add the following line to the Purchase or Upgrade OnClickListener function:
private OnClickListener buttonBuy = new OnClickListener() {
public void onClick(View v) {
String appKey= "[Enter Here the App Key from
previous step]";
String clientId = cloud4apps.Utils.GetClientId(context);
String email = cloud4apps.Utils.GetEmail(context);
cloud4apps.LicenseServices.Purchase(Main.this,
appKey, clientId, email);
}
}
Navigate to
your apps
Click on the app version to obtain the [Version Key] for each version of your app
Add the following code to check if a particular license is active
cloud4apps.LicenseInfo lic = cloud4apps.LicenseInfo.GetActiveLicense(context,
appKey, clientId);
String versionKeyPremium = "";
String versionKeyBasic = "";
if (lic.VersionKey.contentEquals(versionKeyPremium)) {
// Activate app's premium features
} else if (lic.VersionKey.contentEquals(versionKeyBasic )) {
// Activate app's basic features
}
Include the following permissions in your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Download the cloud4apps library from the following link:
https://sourceforge.net/projects/cloud4apps/files/
Extract the zip file to your working directory
Open your Microsoft.NET Solution
Add the cloud4apps.SDK project
Using The Translation Services
If your solution is MVC you can create a model for your view based on the following
code:
// Obtain your app version key from https://www.cloud4apps.com/Account/Apps/List
public const string APP_VERSION_KEY = "your-key-here";
public const string TRANSLATION_LINK = "https://www.cloud4apps.com/Translation/Translate?versionKey="
+ APP_VERSION_KEY;
public string LanguageCode { get; private set; }
public IDictionary<string, string> Languages { get { return cloud4apps.SDK.Localize.AvailableLanguages(APP_VERSION_KEY);
} }
public cloud4apps.SDK.Localize Resources { get { return cloud4apps.SDK.Localize.Translations(APP_VERSION_KEY,
LanguageCode); } }
Access the language resources from your view with the following method:
<%: Model.Resources.GetString("resource_id", "Default text") %>
You can find more implementation details from the cloud4apps.Sample project included
with the SDK