-
Notifications
You must be signed in to change notification settings - Fork 14
Feature Implementation Guide
This page helps to provide an index and walkthrough of each feature we support in our SDKs. Organized by platform.
While we try to supply the same abilities for each version of the SDK, features naturally vary across platforms.
You'll need to make a Project on AppBlade first before implementing any of the features, as valid API keys are required for the SDK to communicate with AppBlade. Your API keys are available under the "Reveal your API Keys" link on the main page of your Project.
###Index#
- iOS
- Registration & Setup
- Authorization and Kill Switch
- Update notifications
- Crash Reporting
- Feedback Reporting
- Session Counting
- Custom Parameters <br><br>
- Android
- Registration & Setup
- Authorization and Kill Switch
- Update notifications
- Crash Reporting
- Feedback Reporting
- Session Counting
- Custom Parameters
Registration is required before calling other features in iOS, since we need a Project ID and the other API information to communicate with AppBlade. Calling any other AppBlade function before registering will throw an AppBladeException telling you which field was left empty or invalid.
Example of such an exception:
*** Terminating app due to uncaught exception 'AppBladeException', reason: 'AppBlade Project ID not set.
Configure the shared AppBlade manager from within your application delegate or AppBlade plist file.'
That means you'll need to Register and Setup your project with proper project keys from AppBlade.
These sections assume you've already followed through with adding the libAppBladeUniversal.a Library or the source to your project and you've added AppBlade.h to your imports. Directions for doing that can be found here.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
AppBlade *blade = [AppBlade sharedManager];
blade.appBladeProjectID = @"00000000-0000-0000-0000-000000000000";
blade.appBladeProjectToken = @"00000000000000000000000000000000";
blade.appBladeProjectSecret = @"00000000000000000000000000000000";
blade.appBladeProjectIssuedTimestamp = @"0000000000";
...
}
The values that the AppBlade sharedManager instance needs are your project API keys and can be found on your AppBlade Project page.
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Check the app blade update status of this application.
[[AppBlade sharedManager] checkForUpdates];
//Do additional things on resume.
}
Since third-party authentication is prohibited by Apple, this feature will be bypassed automatically if the .ipa is signed by Apple.
To enable feedback reporting without the three-finger double-tap prompt, use [[AppBlade sharedManager] setupCustomFeedbackReporting]; and then prompt the feedback window somewhere in your app with [[AppBlade sharedManager] showFeedbackDialogue]. We automatically force one feedback window at a time.
Add a call to [[AppBlade sharedManager] endSession]; under both - (void)applicationWillTerminate:(UIApplication *)application and - (void)applicationWillResignActive:(UIApplication *)application in your AppDelegate. If your app is also meant to background for a specific reason, (such as opening a webpage in Safari), you might need to add conditionals to ensure that you're ending sessions appropriately based on how you want your app to work.
Custom parameters are considered unique to every crash or feedback, so you'll have to reenter data that you want to be persistent.
Currently there isn't a limit to how many parameters you can send, or what they can contain, but please don't go too crazy with them. Also, please respect the privacy of the user and only track application details.
<br> <br>
##Android# Our Android SDK is supported in a basic Eclipse environment with the Android Debug Tools installed. The easiest way to do this (if you haven't already) is through the Google [ADT Eclipse plugin](http://developer.android.com/tools/sdk/eclipse-adt.html).You'll need to make a Project on AppBlade first before implementing any of the features, as valid API keys are required for the SDK to communicate with AppBlade. Your API keys are available under the "Reveal your API Keys" link on the main page of your Project.
These sections assume you have already either imported the AppBlade Android source or imported our compiled library into your workspace. Directions for doing that can be found here.
###Registration & Setup# Registration should be called before any other AppBlade function, so naturally you'd want it declared as early in the process as possible. The best way to ensure this is to make a custom Application class (if you don't already have one) and put your registration inside the `onCreate()` method.To register a custom Application class for your Android app, you will need to refer to it by name in the application element of your project's manifest. For example:
<application android:name=".YourApplication">
<activity
android:name="com.yourpackage.YourMainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Then, register your application details in your Application class' onCreate method:
@Override
public void onCreate() {
super.onCreate();
String token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String uuid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
String issuance = "9999999999";
AppBlade.register(this, token, secret, uuid, issuance);
}
ALSO: Be sure that your application has permission to access the internet to communicate with our server (and store failed requests when it can't) by adding the following permissions to the manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
public class MainActivity extends Activity {
public void onResume() {
super.onResume();
AppBlade.authorize(this);
}
}
You'll need to declare our RemoteAuthorizeActivity among the other activities in your manifest as well, or roll your own Activity. This allows users to sign in through our included webview.
<activity android:name="com.appblade.framework.RemoteAuthorizeActivity" />
``
`` ###Crash Reporting# To enable crash logging globally for your app for all uncaught exceptions, call `AppBlade.registerExceptionHandler();` after your `AppBlade.register(this, token, secret, uuid, issuance);` call. This will grab all uncaught exceptions and attempt to notify AppBlade of them on the next resume of the app. (If you already registered an UncauahtExceptionHandler, our exception handler will store a reference to it and pass the exception down to it). You can also notify AppBlade for a specific exception within your code that you are catching yourself. With in the `try/catch` block of the exception, Add `AppBlade.notify(ex);` of the Exception `ex` that you're catching. See our example project for a working example. ###Feedback Reporting# Unlike iOS, Android does not require any setup call to enable feedback reporting. To prompt a basic feedback reporting dialog, just call the following from within your Activity.
AppBlade.doFeedback(YourActivity.this);
To also include a screenshot to send to AppBlade with your feedback, include an Activity, a View, or a Bitmap or with one of the following functions:
AppBlade.doFeedbackWithScreenshot(Context context, Activity activity);
AppBlade.doFeedbackWithScreenshot(Context context, View view);
AppBlade.doFeedbackWithScreenshot(Context context, Bitmap bitmap);
A precoded dialog will then prompt the user to fill out a message and an option to send the included screenshot.
###Session Counting# To use Session counting, call `AppBlade.startSession()` and `AppBlade.endSession()` in the `onResume()` and `onPause()` functions of your main `Activity`, respectively. *(Or wherever you think is appropriate. The lifespan of Android apps are notoriously difficult to track, and will vary depending on your implementation.)* ###Custom Parameters# Custom Parameters can be included along with Feedback, Crash reports, and Sessions. Call `AppBlade.setCustomParameter(Context, String, Object)` to set or clear a value to send or call `AppBlade.clearCustomParameters(Context)` to clear all stored variables.*Unlike the iOS implementation of AppBlade, the Android SDK uses persistent custom parameters, so you'll have to manually clear them if you don't want them sent.*