Android的:如何做A / B测试平台修改资产飞? [英] Android: How do A/B testing platforms modify assets on the fly?

查看:239
本文介绍了Android的:如何做A / B测试平台修改资产飞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出通过只包括一行code从服务器发送时如何A / B测试SDK替代资产。我知道这可以通过分级分不同的UI元素来完成,但是这将需要大量的code修改。

I was trying to figure out how does A/B testing SDK replace assets when sent from the Server by just including one line of Code. I know this can be done by sub classing various UI elements, but that will require a lot of code modification.

推荐答案

我是领先的Andr​​oid工程师 Taplytics 的。我们做的正是你在说什么!

I'm the lead Android engineer at Taplytics. We do exactly what you're talking about!

目前的核心,它实际上是pretty的简单。很显然,我不能去到什么魔力,我们正在做的全部细节,但我可以给你一个总体思路!

At the core, its actually pretty straightforward. Obviously I can't go into full details on what magic we're doing, but I can give you a general idea!

首先,如果你是一个建造这些A / B测试,我肯定会推荐你继承你的UI元素。这样做是远远比其他解决方案更快,因为它是你的code运行时,你想让它(我会解释这个版本)。最简单的方法是从那里继承查看和工作。

First off, if you are the one building these A/B tests, I definitely recommend you subclass your UI elements. Doing this is far faster than other solutions, because it’s your code running when you want it to (I'll explain this later). The easiest way would be to subclass View and work from there.

背后的A / B测试的技术是一样的pretty的多少你从一台服务器和present给用户得到任何信息。真的是没有什么区别。

The tech behind A/B testing is the same as pretty much any information you get from a server and present to a user. There really is no difference.

现在,解决你的一行code'的评论,还有,还有的秘诀。在iOS上,这些开发者幸运地拥有方法混写,使他们能够从字面上看,当一个方法是被调用,并将其与自己的东西代替。这使事情变得相对容易!

Now, to address your 'one line of code' comment, well, there's the secret sauce. On iOS, those devs are lucky enough to have method swizzling in which they can literally see when a method is being called and replace it with their own stuff. That makes things relatively easy!

但对于Android?好了,没有这样的运气。看看输入PARAMS为每一个A / B测试/分析平台的Andr​​oid: Foo.start(AppContext,apiKey);

But for Android? Well, no such luck. Take a look at the input params for every single A/B testing / Analytics platform on Android: Foo.start(AppContext, "apiKey");

神奇的是,在AppContext。 Appcontext本质上是一个接口转换成Android的自身。这是什么使得它的Andr​​oid不仅仅是Java的替代。 AppContext拥有的一切信息:哪些活动正在运行,的,他们正在运行,有什么意图被传来传去,pretty的每样东西。 随着AppContext在手,你有很多关于应用程序的控制和信息。

The magic is in the AppContext. Appcontext is essentially an interface into Android itself. It’s what makes it Android instead of just Java. AppContext has information about everything: What activities are running, when they are running, what intents are being passed around, pretty much everything. With the AppContext in hand, you have a lot of control and information about the Application.

从那里,你基本上建立一个AppContext树。信息每一点你的应用程序只需要分支AppContext。 AppContext - >活动 - >视图。 AppContext - >活动 - >查看 - >片段 - >片段意见。 AppContext - >服务 - >推送。 Mixpanel实际上调用他们的解决方案,这个ViewCrawling',这可能会给你的是怎么回事一个更好的精神可视化。

From there, you basically build an AppContext tree. Every little bit of information you need from the app just branches off AppContext. AppContext -> Activities -> Views. AppContext -> Activites -> Views -> Fragments -> Fragment Views. AppContext -> Services -> Push. Mixpanel actually calls this 'ViewCrawling' in their solution, which may give you a better mental visualization of what is going on.

您只需要创建这个大缠绕树树枝伸到该应用程序的每个小的方面,因此,当你想改变的东西,你能找到它在你的树!一旦你有你想要什么,你只要抓住从服务器的信息(或本地高速缓存),无论是JSON或XML或什么,让你需要根据这些信息的变化。

You just create this big winding tree with branches reaching into every little aspect of the app so when you want to make a change to something, you are able to find it in your tree! Once you have what you want, you just grab the info from the server (or a local cache), be it JSON or XML or whatever and make the change you need based on that information.

但就像我说的previously,使用自己的用户界面元素。它更容易你只是确定需要甚至绘制元素之前改变。特别是如果你继承视图,你不应该在所有需要很多code。单行安装极致的便利性,使家居的的(SDK的开发)了很多困难。但我不能去要求人们改变每一个观点在他们的应用程序是我自己的事情一个子类,可以吗?

But like I said previously, use your own UI elements. It's far easier on you to just determine what needs to change before even drawing the element. Especially if you subclass View, you shouldn't need a lot of code at all. The One-line installation is pure convenience and makes everything for me (the SDK dev) a lot harder. But I can't go and ask people to change every single view in their app to be a subclass of my own things, can I?

所以它是。它需要Android的SDK的强烈知识,能够抓取到它的每一个方面,是必要的。这个想法很简单,但更深层次的执行得到难以置信的复杂。

So there it is. It requires an intense knowledge of Android's SDK to be able to crawl into every aspect of it as necessary. The idea is simple, but deeper executions get incredibly complex.

我愿意接受任何的问题!那是这一切真正的粗略概述,它变得更加复杂,所以问了。

I'm open to any questions! Thats a real rough overview of it all, and it gets more complex, so ask away.

这篇关于Android的:如何做A / B测试平台修改资产飞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆