excilys/androidannotations — Issue #19: Integration with Capptain through @Capptain
Author: pyricau
Created: 2012-01-06 10:58:53+00:00
State: open
Labels: Enhancement

Capptain is a great "analytics / monitor / reach" product. It has an AndroidLibrary that does great, but the usual way to use it is to extend specific activities, which doesn't integrate well with other frameworks.

However, it's quite easy to create your own custom capptain activities, you just have two calls to do :

```
@Override
protected void onResume() {
super.onResume();
CapptainAgent.getInstance(this).startActivity(this, "ActivityName", null);
}

@Override
protected void onPause() {
super.onPause();
CapptainAgent.getInstance(this).endActivity();
}
````

The usual behavior for "ActivityName" is to take the classname of the activity, and remove any trailing "Activity" string.

We could have a `@Capptain` annotation which would let the user integrate with Capptain without having to write such a code :

```
@Capptain("OptionalName")
public MyActivity extends Activity {

}
```

Please also notice that Capptain is not a free tool. There's a Capptain Plan ("DEV") which is free for apps in development (i.e. small number of unique users/devices). See http://app.capptain.com/#pricing

This idea here is to create a new annotation, called "@Capptain", that would automatically implement this stuff in onResume and onPause. AndroidAnnotations can actually do this kind of things (and w already have a lot of RoboGuice features, we just do it at compile time instead of runtime).

Issue #5 will provide an alternative solution for that.