Manual integration with Eclipse and Ant
One of the key strengths of TestFairy's SDK, is the ease of installation. Our .aar archive updates the AndroidManifest.xml file with the minimum required permissions and activities. However, in some cases, you would more likely want to include the .jar archive, rather than the .aar. Such cases are when you are controlling the permissions manually, when using Ant, or when working with Eclipse.
Please follow these steps to integrate TestFairy's Android SDK in your project:
Download the latest .jar archive from bintray and download the .jar archive from the latest version.
Copy this .jar file into your project, most likely into a directory called
libs
. If you don't have such a directory, please create one in your source root.(Eclipse) You will need to add this .jar archive to
Referenced Libraries
. Right-click on the .jar archive and selectBuild Path > Add to Build Path
.Edit your AndroidManifest.xml file and add these permissions:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Additional permissions are required for specific features in the SDK:
// for auto-update feature <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/> // for sending logs to testfairy <uses-permission android:name="android.permission.READ_LOGS" /> // for tracking wifi signal <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> // for battery status <uses-permission android:name="android.permission.BATTERY_STATS" />
Add these two activities in your
<application>
section in AndroidManifest.xml:<activity android:name="com.testfairy.activities.ProvideFeedbackActivity" android:configChanges="orientation|screenSize" android:theme="@android:style/Theme.Holo.Light" /> <activity android:name="com.testfairy.activities.AutoUpdateActivity" android:configChanges="orientation|screenSize" />
Add Testfairy to your main applications's
onCreate
:import com.testfairy.TestFairy; public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); TestFairy.begin(this, YOUR_APP_TOKEN); // e.g "0000111122223333444455566667777788889999"; }
(Optional) If you have Proguard enabled, please add this snippet to your proguard rules file (eg
proguard-rules.pro
,proguard.cfg
or others):-keep class com.testfairy.** { *; } -dontwarn com.testfairy.** -keepattributes Exceptions, Signature, LineNumberTable
Class Reference
Last updated on 2019-09-24