Swarm Documentation API Reference

Publishing Your App

Estimated Integration Time: 10 minutes

This guide provides step-by-step instructions for preparing your app to be published on the Android Market.

In this section of the guide, we show you how to get your app ready for promotion across the entire Swarm network and how to configure ProGuard (a free Java class file shrinker, optimizer, obfuscator, and preverifier). Using ProGuard is completely optional, but it is a convenient tool that can decrease your app's size and protect your code.


Prerequisites



Check Your Build Target

Swarm will run smoothly in any app on Android 1.5 (API Level 3) or higher.
<uses-sdk android:minSdkVersion="3"/>
However, in order to compile you'll have to set your app's build target to Android 2.3.1 (API Level 9) or higher.


Confirm App Details on Swarm Admin Panel

To help us promote your app across the entire Swarm platform, make sure to confirm your App Details on the Swarm Admin panel. On the App Details page, fill in your app's Package Name and click on the Save button. The Package Name you use here should be the same Package Name that your app uses on the Android Market. While you're here, double check that your app has the App Name field filled in.

Your App Details page should have these fields filled in. Don't forget to add your Package Name!




Improve Offline Support (Recommended)

While you're on the App Details page, download your app's Offline Config File (swarm_app_config.json) and put it in your app's assets folder. This file ensures that players will be able to interact with your social features even if they don't have an internet connection.


Add a Swarm Badge to Your App Icon (Recommended)

Swarm provides badges for your app icons so that users know at first glance that your app has the social features they want! Get Swarm badges here.


(Optional) Launching on the Amazon AppStore

To make your game or app compatible with the Amazon Appstore (or another app store outside of Google Play), simply call the following method just before calling Swarm.init(...);
Swarm.enableAlternativeMarketCompatability();


Update ProGuard Config (Optional - Only required if using ProGuard)

Add the following lines to your app's proguard.cfg file, and then compile and export your signed apk:
-keep class com.swarmconnect.**{*;}

-keepattributes Signature

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}
Example ProGuard Config File:
For reference, an example of a complete proguard.cfg file is shown below.
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field

-keepattributes SourceFile,LineNumberTable,Signature
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native ;
}

-keepclasseswithmembernames class * {
    public (android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public (android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-keep class com.swarmconnect.** { *; }


Congratulations!

Your app is now completely ready for launch on the Android Market and for promotion across the Swarm platform. If you decide to add more features in a future update, come back and check out some of the other great things that Swarm has to offer.

If you have any comments you'd like to share with us about your experience with Swarm, please contact us through the Swarm Support Center.