Rich-text Reply

Android integration "MainActivity"

talm 01-04-17

Android integration "MainActivity"

Assuming I do not follow the "MainActivity" pattern. Do I have to use:

Optimizely.startOptimizelyWithAPIToken("<API Token>", getApplication());  in every activity? In an abstract base?

Apply an intent filter to every activity I have that uses event tracking?

 

Thanks

Level 1

tedroddy 01-05-17
 

Re: Android integration "MainActivity"

Ideally you would have startOptimizelyWithAPIToken in your main activity along with any other entry point activity. Many developers want to put it in Application#onCreate, but when doing this there is an issue entering Edit mode and Preview mode using the O gesture or editor URLs, but our enableEditor and enablePreview methods will still work.

It is safe to call startOptimizelyWithAPIToken repeatedly. Subsequent executions are essentially no-op, but you shouldn't need to use it in every activity.
Best,
Ted
Optimizely