第三方SDK


推送

友盟推送

Openfire 自己来搭建基于XMPP协议的推送、IM服务器

Openfire 是基于Jabber协议(XMPP)实现的即时通信服务器端版本,使用java来实现的

单台服务器可支持上万并发用户。

官网:http://www.igniterealtime.org/projects/openfire/index.jsp

个推

推送效率不错,偶尔也会有延迟,当然这个是免费版本,免费版本目前的限制是留存用户500万以下,20万条/秒(共享)。用户有新浪微博和去哪儿。

官网:http://www.getui.com/

极光推送

觉得还不错,稳定,也是免费的,不过在并发数有高峰期有资源瓶颈,但是一般来说的应用已经满足了。

官网:https://www.jpush.cn/

百度推送

百度推送个人感觉中规中矩,相信百度公司的技术还是可以的。可以免费使用,这个值得拥有。

官网:http://push.baidu.com/fc

信鸽

qq大品牌了,毕竟有巨大的用户数据,很多开发者为了省事,直接接入腾讯的qq登陆,微信登陆和推送,这样一站式的,懒得管理那么多的app key 和 app ID。

官网:http://xg.qq.com/xg/

小米推送

小米推送,依赖着米聊的成功,再开拓了小米手机,小米在软硬件结合的基础上,为开发者提供者推送还是综合几方面的。

官网:http://dev.xiaomi.com/mipush/downpage/

IM

腾讯云通信

相信依赖qq的成功,相信不少开发者都冲着qq来,纷纷在自己的应用上接入im了。是基于自己的协议来通信的,效率不错。

http://www.qcloud.com/product/im.html

网易云信

网易的产品觉得还是有品质的。可以支持文字、表情、图片、语音、视频、地理位置、通知消息、自定义消息,而且可获得消息的已读状态,还可以实现自定义消息。

http://netease.im/

融云

首先是免费的,其次,全球都有节点,很多功能没有限制,不错,而且里面的技术支持相当的给力,星期六天都帮解决问题,值得赞。

http://www.rongcloud.cn/

环信

2个坐席以内永久免费,至于什么是两个坐席,可以到官网看看,环信貌似是基于xmpp协议来开发的

http://www.easemob.com/

直播

乐视云

觉得最好的一点居然是免费的,所以第一个推荐,但是会有乐视的广告,但是对于我们小开发者来说,影响不大,对于大开发者可以选择去广告。提供点播和直播功能,觉得都不错,还有cdn,为我们省了不少的直播流量

http://www.lecloud.com/live.html

腾讯直播

功能多,支持HLS拉流,RTMP推流方式,结合腾讯云互动直播服务提供Android/iOS/Windows/Web SDK,可快速集成多平台的音视频采集及开播能力,实现HLS、RTMP单向直播下发的同时,还能实现互动直播。价格如下。

android和ios实现推送、im、直播功能SDK集锦

http://www.qcloud.com/product/LVB.html

百度推送

产品名字叫做:音视频直播 LSS

android和ios实现推送、im、直播功能SDK集锦

https://bce.baidu.com/doc/LSS/GettingStarted.html#.E7.9B.B4.E6.92.AD.E6.8E.A8.E6.B5.81

网易云信

提供直播功能,如果想一站式实现推送,im,直播,教学的,可以考虑一下这个,不过具体价格可议联系客服

http://netease.im/

微信

微信js sdk

  1. 必须申请企业微信公众号

  2. 需要认证企业公众号

  3. 确认有分享的相关权限

  4. 启动getSign的nodejs服务,需要配置公众号的两个key

  5. html页面部署的服务器如果是阿里云,域名必须在工信部备案,在阿里云也要备案

  6. html页面必须部署在80端口或443服务器上,微信要求的

  7. 域名必须在公众号里面进行配置,只需要一级域名即可

  8. html页面js代码示例

     var http = null;
     
     if (window.XMLHttpRequest) {
         // code for IE7+, Firefox, Chrome, Opera, Safari
         http = new XMLHttpRequest();
     } else {
         // code for IE6, IE5
         http = new ActiveXObject("Microsoft.XMLHTTP");
     }
     
     function shareConfig(title, desc, link, imgUrl) {
         if(!window.wx) return;
     
         // 分享给朋友
         wx.onMenuShareAppMessage({
             title: title,
             desc: desc,
             link: link,
             imgUrl: imgUrl,
             success: function(res) {
             },
             fail: function(res) {
             }
         });
     
         // 分享到朋友圈
         wx.onMenuShareTimeline({
             title: title,
             desc: desc,
             link: link,
             imgUrl: imgUrl,
             success: function(res) {
             },
             fail: function(res) {
             }
         });
     
         // 分享到QQ
         wx.onMenuShareQQ({
             title: title,
             desc: desc,
             link: link,
             imgUrl: imgUrl,
             success: function(res) {
             },
             fail: function(res) {
             }
         });
     
         // 分享到微博
         wx.onMenuShareWeibo({
             title: title,
             desc: desc,
             link: link,
             imgUrl: imgUrl,
             success: function(res) {
             },
             fail: function(res) {
             }
         });
     }
     
     function wxInit() {
         if (http.readyState == 4 && http.status == 200) {
             var d = http.responseText;
             var obj = JSON.parse(d);
             alert(d);
             wx.config({
                 debug: false,
                 appId: 'wx8923c424f092e0af', // 这里是已认证微信公众号的appid,需要与getSign的一致
                 timestamp: obj.timestamp,
                 nonceStr: obj.nonceStr,
                 signature: obj.signature,
                 jsApiList: [
                     'onMenuShareTimeline',
                     'onMenuShareAppMessage',
                     'onMenuShareQQ',
                     'onMenuShareWeibo'
                 ]
             });
             var title = '活动公告';
             var desc = '玩《星际枪战》,看《魔兽大电影》!还有精美游戏礼包!人人都有!等你来拿!';
             var link = 'http://www.gamedo.net/test/index5.html'; // 这是分享的url,可以是任意url,分享朋友圈时需要注意有限制url的规范
             var imgUrl = 'http://xingji.feeker.net:7960/icon.png';
             wx.ready(function() {
                 shareConfig(title, desc, link, imgUrl);
             });
         }
     }
     
     window.onload = function() {
         if (!http) {
             alert('您的浏览器不支持AJAX!');
             return;
         }
         // 这是getSign的url,需要在getSign代码里配置appid和key
         var url = "http://211.101.18.76:8889/get_sign?game_url=" + encodeURIComponent(location.href).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
         http.open("GET", url, true);
         http.onreadystatechange = wxInit;
         http.send();
     }
    

怎样才能看到源码

https://segmentfault.com/q/1010000000643865
  1. 基于微信OAuth2.0开发的小游戏,限制了只在微信内置浏览器打开,要怎样才能看到源码呢?

    a) https://wx.qq.com/ 上这个,扫一扫微信号

    b) 把链接复制到网页版微信中打开就能看源码

    c) 聊天栏试试,或者再在浏览器输入原始URL

     会得到一个oauth的网页URL,复制到网页微信聊天栏里,再在微信聊天中打开,多试几次,直到弹出下面的网页即可,这是第一次授权才会出现,同意授权后就不会再出现
    

Adjust

  • 海外渠道结算指定平台

总部位于柏林的Adjust公司

如智明星通、莉莉丝、Funplus、绿洲游戏、R2Games、掌趣科技、华清飞扬等游戏公司,正在使用Adjust平台来评估其在海外市场的推广效果。

Adjust已经与腾讯广点通,今日头条、YeahMobi、Alibaba、粉丝通、多盟、畅思及时趣互动等国内多家主流广告流量平台合作。深度对接后,广告主可以更加准确的进行中国本地广告的推广和监测。

微博

FaceBook

Google

Google Analystics

  1. 数据收集限制

1000万次/月

  • 可以升级到Google Analystics 360付费版
  • 或升级到Google Analystics for Firebase 无限制免费分析方案
  1. 与友盟统计的差异
  • 次留差异

友盟如果是25%次留;GA为45%次留

googleapis 查询谷歌订单支付API,验证是否购买成功

  1. 谷歌应用发布
  • 注册登陆Google Play Console,需要支付25美金注册开发者账号

https://play.google.com/apps/publish/

到Android交易市场的发布商区进行注册

https://play.google.com/apps/publish/这个地址到Android交易市场的发布商区域进行注册,成为一个正式的开发商。你需要支付一次性的25美元的注册费。

如果你的应用是收费的,你需要设立一个Google商务账户(Google Merchant Account)。除非你想运营一个真正的应用开发商店,你只需要简单的选择把你的所有应用销售收入都存放到你选择的银行帐号里,这个过程非常的直接简单:你需要知道的只是这个开户过程需要1至2天的时间。有了账户后,Google就会每天一次的把你的销售收入打入你提供的账户里(不包括要求退款的收入,周末和银行假期不结帐)。用户可以在购买你的应用后的24小时内选择“退货”(超过24小时意味着不能退货),所以Google会自动的在你的商务账户里扣下足够的钱来保证退款事务。

  • 创建应用

填写完整信息(上传图片等)

  • apk包签名

可以使用 Android Studio 生成应用签名或上传密钥,步骤如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
在菜单栏中,点击 Build > Generate Signed APK。
从下拉菜单中选择一个模块,然后点击 Next。
点击 Create new 以创建一个新密钥和密钥库。
在 New Key Store 窗口上,为您的密钥库和密钥提供以下信息,在 Android Studio 中创建新的密钥库。

密钥库

Key store path:选择创建密钥库的位置。
Password:为您的密钥库创建并确认一个安全的密码。
密钥

Alias:为您的密钥输入一个标识名。
Password:为您的密钥创建并确认一个安全的密码。此密码应当与您为密钥库选择的密码不同
Validity (years):以年为单位设置密钥的有效时长。密钥的有效期应至少为 25 年,以便您可以在应用的整个生命期内使用相同的密钥签署应用更新。
Certificate:为证书输入一些关于您自己的信息。此信息不会显示在应用中,但会作为 APK 的一部分包含在您的证书中。
填写完表单后,请点击 OK。
  • apk上传

选左侧“应用版本”——在“正式版渠道”选择“管理”——上传apk——完成信息填写

如果是“Beta 版”则需要添加测试人员,选择“Beta 版”后面的“管理”按钮,进入进行信息填写

  • 内容分级

选左侧“内容分级”——填写内容

  • 定价和分发范围

  • 版本发布

选左侧“应用版本”——“开放式渠道”——“修改版本”——“查看”——“开始发布Beta 版”——“发布正式版”——“查看”——“开始发布正式版”

经过大概1.5-2小时的等待,应用会被Google Play审核通过。

确认应用是否成功发布,应以在浏览器中输入包名查看为准,而并非以搜索为准。

输入包名的方法:
https://play.google.com/store/apps/details?id=com.mediocre.commute&hl=zh-CN

将以上链接中红色部分替换成你的游戏的包名即可。

  • 创建API项目

打开网址:

https://console.developers.google.com/projectcreate

输入项目名称进行API项目创建

进入网址:

https://console.developers.google.com/home/dashboard

选择刚创建的项目——“信息中心”——“启用API和服务”

添加启用“URL Shortener API”和“Google Play Android Developer API”、“Google Play Game Services”、“Google Play Game Management”

“凭据”——“创建凭据”——“API密钥”

“凭据”——“创建凭据”——“创建 OAuth 客户端 ID”

选择android,查询输入签名证书的指纹

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
keytool -exportcert -keystore H:\keystroe\googleapitestkey.jks -list -v
输入密钥库口令:

密钥库类型: JKS
密钥库提供方: SUN

您的密钥库包含 1 个条目

别名: googleapitestkey
创建日期: 2018-5-17
条目类型: PrivateKeyEntry
证书链长度: 1
证书[1]:
所有者: CN=googleapitestkey, OU=googleapitestkey, O=googleapitestkey, L=googleapitestkey, ST=googleapitestkey, C=googleapitestkey
发布者: CN=googleapitestkey, OU=googleapitestkey, O=googleapitestkey, L=googleapitestkey, ST=googleapitestkey, C=googleapitestkey
序列号: 894c3be
有效期开始日期: Thu May 17 14:04:08 GMT+08:00 2018, 截止日期: Mon May 11 14:04:08 GMT+08:00 2043
证书指纹:
MD5: A4:AC:B5:82:E0:B9:65:CD:DF:B5:D5:63:2D:C5:54:F4
SHA1: 10:6B:DE:39:FB:74:62:50:C9:55:6E:F6:77:BF:22:7D:24:F7:F8:09
SHA256: 02:96:A2:24:CF:20:68:C0:EF:E3:6B:EF:52:12:6E:F1:A1:68:7A:D2:06:24:9D:C9:ED:13:9F:91:4D:11:A0:7E
签名算法名称: SHA256withRSA
版本: 3
  • 游戏服务

“游戏服务”——“添加新游戏”——“我已经在自己的游戏中使用了 Google API”——选择刚才建立的API项目

新建成功后,在“游戏详情”最下方可以看到如下:

1
2
3
API 控制台项目

此游戏已与名为“XXXXX”的 API 控制台项目关联

上传icon和大图,填写说明,保存

“关联的应用”——Android——“软件包名称”下拉选择前前面创建的应用——保存继续——立即向您的应用授权——“创建 Android OAuth 客户端”确认(API 请求会从客户端的 Android 设备直接发送至 Google。Google 会验证从 Android 应用发出的每个请求是否与文件包名称和下方列出的 SHA1 签名证书指纹名称相符。)

“发布”——“发布游戏”(如不能发布,参照页面提示补充填写信息)

发布后,游戏服务功能可能要过几个小时后才能生效。

  1. 谷歌应用API配置
  • 开启API访问权限

登陆Google Play Console——“设置”——“开发者账号”——“API权限”

Games Services Publishing API 开启

点击“Games configuration API”旁边的启用按钮

  • 关联项目

“游戏服务”——选择已发布的游戏——

1
2
3
4
Go to the API Access page on the Google Play Console.
Accept the API Terms of Service.
Choose the project you’d like to link.
Click Link.
  1. Nodejs开发
  • googleapis

安装:

1
npm i googleapis

使用:

==想成功连接到googleapi需要配置网络环境:参加Windows文档里面的”win 10 系统下,配置网络环境访问google play,进行nodejs调试的环境搭建”==

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const {google} = require('googleapis');

// Each API may support multiple version. With this sample, we're getting
// v1 of the urlshortener API, and using an API key to authenticate.
const urlshortener = google.urlshortener({
version: 'v1',
auth: 'xxxx' // 这里输入上面生成的"API密钥"
});

const params = {
shortUrl: 'http://goo.gl/xKbRu3'
};

// get the long url of a shortened url
urlshortener.url.get(params, (err, res) => {
if (err) {
console.error(err);
throw err;
}
console.log(`Long url is ${res.data.longUrl}`);
});
  1. 获取订单购买状态
  • 谷歌页面查看订单参数

“订单管理”——选择一个已经付款的订单进入——点击“查看购买交易凭证”获取订单的购买令牌token值,后面用到——查看SKU值(后面productId用到)

  • 获取OAuth 2.0 客户端 ID

“凭据”——选择之前创建的OAuth——点击“下载JSON”——改名为“oauth2.keys.json”放到nodejs项目目录中

  • 新建oauth2验证方法

sampleclient.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const {google} = require('googleapis');
const http = require('http');
const url = require('url');
const querystring = require('querystring');
const opn = require('opn');
const destroyer = require('server-destroy');
const fs = require('fs');
const path = require('path');

const keyPath = path.join(__dirname, 'oauth2.keys.json'); // 刚才下载的OAuth 2.0 客户端 ID的json文件
let keys = { redirect_uris: [''] };
if (fs.existsSync(keyPath)) {
keys = require(keyPath).installed;
}

class SampleClient {
constructor (options) {
this._options = options || { scopes: [] };

// create an oAuth client to authorize the API call
this.oAuth2Client = new google.auth.OAuth2(
keys.client_id,
keys.client_secret,
keys.redirect_uris[0]
);
}

// Open an http server to accept the oauth callback. In this
// simple example, the only request to our webserver is to
// /oauth2callback?code=<code>
async authenticate (scopes) {
return new Promise((resolve, reject) => {
// grab the url that will be used for authorization
this.authorizeUrl = this.oAuth2Client.generateAuthUrl({
access_type: 'offline',
scope: scopes.join(' ')
});
const server = http.createServer(async (req, res) => { // 这是在网页登录验证后获取到的code的回调url,访问后会继续运行后面的googleapi查询方法:http://localhost:3000/oauth2callback?code=4/AABV3uZCg81_3VgtS_Lx2IAWNIJ71SzcsgK05H6Pz29y1ywQKgyrbJs
try {
if (req.url.indexOf('/oauth2callback') > -1) {
const qs = querystring.parse(url.parse(req.url).query);
res.end('Authentication successful! Please return to the console.');
server.destroy();
const {tokens} = await this.oAuth2Client.getToken(qs.code);
this.oAuth2Client.credentials = tokens;
resolve(this.oAuth2Client);
}
} catch (e) {
reject(e);
}
}).listen(3000, () => {
// open the browser to the authorize url to start the workflow
opn(this.authorizeUrl, {wait: false}).then(cp => cp.unref());
});
destroyer(server);
});
}
}

module.exports = new SampleClient();
  • 新建查询订单购买状态方法

androidpublisher.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';

const {google} = require('googleapis');
const sampleClient = require('../sampleclient');

const androidpublisher = google.androidpublisher({
version: 'v2',
auth: sampleClient.oAuth2Client
});

async function get () {
const res = await androidpublisher.purchases.products.get({
packageName: 'com.xxx.xxx', // 这里是应用的包名
productId: '5', // 这里是上面的SKU
token: 'xxxxxx' // 这里是上面购买令牌token值
});
console.log(JSON.stringify(res.data));
return res.data;
}

const scopes = [
'https://www.googleapis.com/auth/androidpublisher'
];

sampleClient.authenticate(scopes)
.then(() => get())
.catch(console.error);
  • 运行 node androidpublisher.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"kind": "androidpublisher#productPurchase",
"purchaseTimeMillis": "1516374974769",
"purchaseState": 0,
"consumptionState": 0,
"developerPayload": "1516374922904",
"orderId": "GPA.3388-9779-6053-91026",
"purchaseType": 0
}

roperty name Value Description Notes
consumptionState integer The consumption state of the inapp product. Possible values are:
0 Yet to be consumed
1 Consumed
developerPayload string A developer-specified string that contains supplemental information about an order.
kind string This kind represents an inappPurchase object in the androidpublisher service.
orderId string The order id associated with the purchase of the inapp product.
purchaseState integer The purchase state of the order. Possible values are:
0 Purchased
1 Canceled
purchaseTimeMillis long The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
purchaseType integer The type of purchase of the inapp product. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are:
0 Test (i.e. purchased from a license testing account)
1 Promo (i.e. purchased using a promo code)
  1. JWT验证方式(服务帐号密钥方式)
  • 新建服务帐号密钥

“凭据”——“创建凭据”——“服务帐号密钥”——“新的服务账号”

填写服务账号名称,选择角色“所有者”

==服务帐号 ID会自动填写,记住后面需要给这个账户单独权限,否则访问会报401错误==

密钥类型选择“JSON”

点击创建——下载密钥文件——保存成“jwt.keys.json”到nodejs项目目录

  • API给服务帐号 ID 权限

登陆“Google APIs”——“IAM和管理”——“IAM”——点击“添加”按钮

“新成员”输入上面生成的“服务帐号 ID”,系统会自动搜索到

选择角色“所有者”保存

  • Google Play Console给服务帐号 ID 权限

“Google Play Console”——“设置”——“开发者账号”——“用户和权限”——“邀请新用户”

1
2
3
4
电子邮件:填写上面的“服务帐号 ID”(例如:new-441@jumpingtest-32054653.iam.gserviceaccount.com)
权限到期日期:永不
角色:管理员
添加应用:选择我们的应用

点“添加用户”保存

  • 建立jwt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';

const {google} = require('googleapis');
const path = require('path');

async function runSample () {
// Create a new JWT client using the key file downloaded from the Google Developer Console
const client = await google.auth.getClient({
keyFile: path.join(__dirname, 'jwt.keys.json'),
scopes: ['https://www.googleapis.com/auth/androidpublisher']
});

const androidpublisher = google.androidpublisher({
version: 'v2',
auth: client
});

const res = await androidpublisher.purchases.products.get({
packageName: 'xxxx',
productId: '5',
token: 'xxxxxx'
});
console.log(JSON.stringify(res.data));

return res.data;
}

if (module === require.main) {
runSample().catch(console.error);
}

module.exports = { runSample };

AdSense 内容广告

  • Google Ads 花钱投放广告

  • AdSense 赚钱播放广告

1
2
3
4
5
6
7
8
9
通过展示AdSense内容广告,发布商可从Google收取的服务相关收益中分得68%的金额。
而通过展示 AdSense 搜索广告,发布商可从 Google 收取的收益中分得51%的金额。

可以在自己的帐户中查看收益分成的详细信息:

登录到您的 AdSense 帐户。
在左侧导航栏中,点击设置。
点击帐户,然后点击帐户信息。
在“帐户信息”部分中,您可以在“正在使用的产品”旁边看到每项收益分成。

AdSense 视频广告

AdSense 游戏广告(AFG)

  • 要求

如果要将 AdSense 游戏广告集成到基于 HTML5 的网页游戏中,需要满足以下前提条件:

1
2
3
4
确保您的行为符合 AdSense 合作规范,包括具体的游戏广告规范。
使用的游戏启动器需要具备 Google IMA SDK 集成能力并/或符合 VAST 3.0 与 VPAID 2 JS 标准。
利用基于 HTML5 的游戏启动器:AdSense 游戏广告仅支持基于 HTML5 的网页游戏内容。
拥有足够丰富的游戏内容:游戏内容超过 70%,每月游戏展示次数在 100 万次以上。

AdSense游戏广告代码参数指南:https://support.google.com/adsense/answer/6328034

IMA DAI SDKs:https://developers.google.com/interactive-media-ads/

问题汇总

  1. 打包安卓SDK调用Sign In的API接口总是登录失败

必须发布应用后,才能Sign In登录成功!

a