在Android中使用GCM与ASP.NET服务器推送通知(如何获取和动态发送IDS)。

问题描述:

有一些疑问......

Having some of the queries....

final String regId = GCMRegistrar.getRegistrationId(this);               // MainActivity.java class

通过这句话,我收到动态注册ID为运行此应用程序的设备,从而发送到Web服务器。但正如你除了说任何其他标​​识因素(用户ID或电话标识)发送到Web服务器。如何获得并动态地发送这些标识。

By this statement I am receiving registration id dynamically for devices running this application and thus sending to the web server. But as you said in addition to send any other identifying factor (user id or phone id) to the webserver. How to get and send those ids dynamically.

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
 for (int i = 0; i < Vars.length; i++) {
            nameValuePairs.add(new BasicNameValuePair(Vars[i][0], Vars[i][1]));

如何动态设置数组维度,因为这取决于注册的设备,我设置的注册ID的数组所有注册设备并发送,为Web服务器。
请粘贴您OnRegistered&放大器;在GCMIntentService类未注册的方法。

How to set the array dimension dynamically, because depending upon the registered devices, I am setting the array of registration id for all those registered devices and sending that to web server. Please paste your OnRegistered & UnRegistered Method of the GCMIntentService class.

另外如何在服务器端.NET开发人员将数据的阵列发送到GCM服务器。现在他正在发送注册ID在多个设备JSON格式,但它不执行。我们正在404错误或错误请求。对于使用它在服务器端执行此下面的语句单一的注册ID。

Also how in the server side .net developer will send that array of data to GCM server. Now he is sending registration id in json format for multiple devices, but it is not executing. We are getting 404 error or Bad request. For single registration id using this below statement it is executing in the server side.

string postData = "collapse_key=score_update&time_to_live=108&delay_while_idle=1&data.message=" + value + "&data.time=" + System.DateTime.Now.ToString() + "&registration_id=" + deviceIDs + "";

请让我知道如果任何其它ID将被传递。因为什么迷惑我,一个应用程序可以由多个用户1000+安装。它是高效存储在数据库中的一颗颗IDS?因为我们的服务器发送一颗颗ID来GCM服务器,否则大家将不会收到推送通知。

Please let me know if any other id has to be passed. Because what confuse me that an application can be installed by more than 1000+ users. Is it efficient to store those many ids in the database??? Because our server has to send those many ids to GCM server, else everyone will not receive the push notification.

注册ID被改变periodically.i与zhydian IDS同意将不再有效。

Registration ids are changed periodically.i agree with zhydian ids will no longer be valid.

识别设备,您可以使用独特的设备没有。

for identifying device you can use unique device no.