简体   繁体   English

Android:使用Facebook共享或推文解锁应用程序的附加功能

[英]Android: Unlock application's additional features with Facebook share or tweet

I have a free application published on Google Play. 我在Google Play上发布了免费应用程序。 I want to add some new features and ask users to 'pay' for them with Facebook shares or tweets. 我想添加一些新功能,并要求用户使用Facebook分享或推文“付费”。

Scenario: 场景:

  1. User updates application 用户更新应用程序
  2. New features are available in settings but they are not active 设置中提供了新功能,但它们未处于活动状态
  3. To activate feature user has to share information about my application on FB or on Tweeter 要激活功能,用户必须在FB或Tweeter上共享有关我的应用程序的信息
  4. Only if sharing was successful feature will be available to the user. 只有共享成功时,用户才能使用该功能。

For me it seems like a good idea to spread information about application in social media... however I can't find any 'out of the box' solution (library or code). 对我而言,在社交媒体中传播有关应用程序的信息似乎是一个好主意......但是我找不到任何“开箱即用”的解决方案(库或代码)。 Is there any? 有没有?

Has anybody tried this approach and was it successful? 有没有人尝试过这种方法并且成功了吗?

Also I'm trying to find out if this method is compliant with Google Play policy. 另外,我想知道这种方法是否符合Google Play政策。 I've read https://play.google.com/about/developer-content-policy.html with great care but I didn't find any clues. 我非常谨慎地阅读了https://play.google.com/about/developer-content-policy.html ,但我没有找到任何线索。 Has anyone got any policy violations emails from Google after implementing this method? 实施此方法后,是否有人收到来自Google的任何政策违规电子邮件?

I've been working on something similar for a bit. 我一直在研究类似的东西。 As far as sharing itself goes, that's fairly straightforward using the ShareActionProvider . 就共享本身而言,使用ShareActionProvider相当简单。 There's a tutorial for that here . 有该教程在这里

However, this doesn't give you any way to determine of the user successfully shared anything, it only provides the ability to share something. 但是,这并不能让您以任何方式确定用户是否成功共享任何内容,它只提供共享内容的能力。 You can do something when a share target is selected, however, by using setOnShareTargetSelectedListener() with your own OnShareTargetSelectedListener implementation on your ShareActionProvider . 但是,通过在setOnShareTargetSelectedListener()使用setOnShareTargetSelectedListener()和您自己的OnShareTargetSelectedListener实现,可以在选择共享目标时执行某些ShareActionProvider

Again, though, this is problematic because it only allows you to determine whether a user has clicked an application through which to share information, not whether they actually followed through and shared anything. 但是,这仍然存在问题,因为它只允许您确定用户是否已单击通过其共享信息的应用程序,而不是他们是否实际遵循并共享任何内容。 You can go a bit farther by creating your own custom share action and using startActivityForResult() rather than startActivity() , then reading the Intent data and int resultCode from onActivityResult() . 您可以通过创建自己的自定义共享操作并使用startActivityForResult()而不是startActivity() ,然后从onActivityResult()读取Intent data和int resultCodeonActivityResult() This will tell you when the sharing has been complete. 这将告诉您共享何时完成。

Doing this will, unfortunately, lead you only to another wall. 不幸的是,这样做会导致你只到另一面墙。 The data and resultCode arguments are passed to your app by the application the user is sharing to, which means they aren't exactly consistent from app to app. dataresultCode参数由用户共享的应用程序传递给您的应用程序,这意味着它们在应用程序之间并不完全一致。 In fact, most apps don't even seem to distinguish between whether the user shared something or just exited out without sharing. 实际上,大多数应用程序似乎甚至无法区分用户是否共享某些内容,或者只是在没有共享的情况下退出。 Usually they just return a resultCode of 0, regardless of whether the share was successful or not. 通常它们只返回一个0的resultCode ,无论共享是否成功。 And the data Intent is often times null. 并且data Intent通常为空。 Truly, there doesn't seem to be any way to consistently determine if the user actually successfully shared the content. 实际上,似乎没有任何方法可以始终如一地确定用户是否实际成功共享了内容。

With this in mind, if your rewards aren't too big, you may consider simply rewarding the user in your OnShareTargetSelectedListener and hope users are trustworthy enough to actually share your application. 考虑到这一点,如果您的奖励不是太大,您可以考虑在OnShareTargetSelectedListener奖励用户,并希望用户足够值得信任以实际共享您的应用程序。 Or you could rethink whether rewarding users for sharing is the best idea after all. 或者你可以重新考虑是否奖励用户分享是最好的主意。 Though as far as I know, it's not against any policy violation. 虽然据我所知,这并不违反任何政策违规行为。 Personally, I think it's a fairly good idea if you're only giving the user small rewards; 就个人而言,我认为如果你只给予用户小额奖励,这是一个相当不错的主意; unfortunately it's a shame that there's no way (at least that I know of) to be able to determine if the user actually shared the content. 遗憾的是,能够确定用户是否真正共享内容是没有办法的(至少我知道)。

I also may be responding to this a month late, but I figure better late than never and it may be a good idea to share my experience in case anyone else was curious as well. 我也可能迟到一个月回应这个问题,但是我觉得迟到总比没有好,分享我的经验可能是一个好主意,万一其他人也很好奇。

Edit: Just realized you specified Facebook and Twitter. 编辑:刚刚意识到你指定了Facebook和Twitter。 As far as I was able to figure out, Facebook doesn't distinguish whether the user actually shared anything, so implementing this with Facebook is, as described above, not possible. 据我所知,Facebook并没有区分用户是否真正分享了任何东西,因此如上所述,用Facebook实现这一点是不可能的。 Twitter does actually distinguish a resultCode of -1 when the user shares, and 0 when the user does not, so it may be possible with Twitter. Twitter确实在用户共享时将resultCode分为-1,而在用户不共享时将其区分为0,因此可能使用Twitter。

You could also look at the Facebook API to see if they have any support for something like this, but I haven't checked that out at all. 您还可以查看Facebook API以查看他们是否对此类内容有任何支持,但我还没有检查过。

For Facebook already is an method like: SHARE CALLBACK .And has on success listener. 对于Facebook已经是一种方法:SHARE CALLBACK。并且有成功监听器。 So if shared content is suscefully posted on user Facebook you can write you next action code inside on success listener. 因此,如果共享内容在用户Facebook上发布,您可以在成功监听器中写下您的下一个操作代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM