<div dir="ltr"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-top:0px!important">Hi,</p>
<p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">the client side spec describes the required functionality to register devices with the Unified Push Server.</p>
<p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">The client SKD should be simple to use. For the iOS, I thought about a register that takes three blocks:</p>
<ul style="margin:15px 0px;padding:0px 0px 0px 30px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px"><li>ClientDeviceInformation object/protocol (similar to our configuration objects)</li>
<li>success callback</li><li>failure callback</li></ul><div class="" style="border:0px;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span class="" style="color:rgb(153,153,136);font-style:italic">// AppDelegate code/delegate function, for a push enabled application:</span>
<span class="" style="font-weight:bold">-</span> <span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">void</span><span class="">)</span><span class="" style="color:rgb(153,0,0);font-weight:bold">application:</span><span class="">(</span><span class="" style="color:rgb(51,51,51)">UIApplication</span> <span class="" style="font-weight:bold">*</span><span class="">)</span><span class="" style="color:teal">application</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// deviceToken provided by APNs</span>
<span class="">didRegisterForRemoteNotificationsWithDeviceToken:</span><span class="">(</span><span class="" style="color:rgb(51,51,51)">NSData</span> <span class="" style="font-weight:bold">*</span><span class="">)</span><span class="" style="color:teal">deviceToken</span> <span class="">{</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// the AG AGDeviceRegistration helper/class:</span>
<span class="">[</span><span class="" style="color:rgb(51,51,51)">registration</span> <span class="" style="color:rgb(51,51,51)">registerWithClientInfo</span><span class="" style="font-weight:bold">:^</span><span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">id</span><span class="" style="font-weight:bold"><</span><span class="" style="color:rgb(51,51,51)">AGClientDeviceInformation</span><span class="" style="font-weight:bold">></span> <span class="" style="color:rgb(51,51,51)">clientInfo</span><span class="">)</span> <span class="">{</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// apply the desired info:</span>
<span class="" style="color:rgb(51,51,51)">clientInfo</span><span class="">.</span><span class="" style="color:rgb(51,51,51)">token</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(51,51,51)">deviceToken</span><span class="">;</span>
<span class="" style="color:rgb(51,51,51)">clientInfo</span><span class="">.</span><span class="" style="color:rgb(51,51,51)">alias</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(221,17,68)">@"<a href="mailto:mister@xyz.com">mister@xyz.com</a>"</span><span class="">;</span>
<span class="" style="color:rgb(51,51,51)">clientInfo</span><span class="">.</span><span class="" style="color:rgb(51,51,51)">mobileVariantID</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(221,17,68)">@"123456432134564321345432"</span><span class="">;</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// ... as needed more of the data;</span>
<span class="">}</span> <span class="" style="color:rgb(51,51,51)">success</span><span class="" style="font-weight:bold">:^</span><span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">id</span> <span class="" style="color:rgb(51,51,51)">responseObject</span><span class="">)</span> <span class="">{</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// invoked, on 200 HTTP response code from the Unified Push Server</span>
<span class="">}</span> <span class="" style="color:rgb(51,51,51)">failure</span><span class="" style="font-weight:bold">:^</span><span class="">(</span><span class="" style="color:rgb(51,51,51)">NSError</span> <span class="" style="font-weight:bold">*</span><span class="" style="color:rgb(51,51,51)">error</span><span class="">)</span> <span class="">{</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// invoked:</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// missing required data (e.g. no token submitted)</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// on 4xx/5zz HTTP response codes from the Unified Push Server</span>
<span class="">}];</span>
<span class="">}</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">The above <code style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation Mono',Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">registerWithClientInfo:successfailure</code> method uses <code style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation Mono',Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">AFNetworking</code> to submit the received<code style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation Mono',Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">deviceToken</code> to the <em>AeroGear Unified Push Server</em>. The desired information data is provided on the first callback.</p>
<p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">The concept of a "block" for setting up data/objects has been useful on <code style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation Mono',Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">AGPipeConfig</code>, so reusing the concept here as well.</p>
<p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important"><strong>Note:</strong> Class/method names may change over time...</p>
<p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important">Thoughts ?</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-bottom:0px!important">
<br></p><div><br></div><div style>-Matthias</div><div style><br></div><div style><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div>