androidmillennial-media

Integrate Millennial Media Ads using GET Method in Android


Android 2.3.3

The documentation of Millennial Media says that I can use a HTTP GET Query to get the AD as a HTML Response.

My client application needs the ads to be embedded in an article, that comes as a response from server. After getting the response, we construct the page, using HTML tags and display it in a viewpager. While constructing the page, since the response is HTML, i can add it to the page before it gets displayed.

To construct a HTTP GET query, we need to have

  1. APID The Ad Placement ID.

  2. AUID The Unique Identifier for the device.

  3. UA User Agent.

  4. UIP The User's Public IP Address.

Where do I get the above to construct the GET query,

  1. APID - from the mmedia site (in my account)

  2. AUID - ?

  3. UA - ?

  4. UIP - ?

How can I query these details?

If someone has previously done this or has an example or a link, please guide me.

EDIT :::

@Millennial Mark

Thanks for the help. Now I have, APID and AUID. I am building this on the client side. So, I can query your server with just these two values and I get a response. - Understood till here.

So assuming my apid = 123149 and auid = eeabcef75ce706b4, my url would be,

http://ads.mp.mydas.mobi/getAd?apid=123149&auid=eeabcef75ce706b4

that's it. No other data needed?

Next question is :::

Can I query the server, with what size of the AD i want. For example, if the app is running on an tablet, I would need a larger banner (for ex: 728x90) than the one I display on the phone(for ex: 320x50). So, can I send the needed banner size along with the HTTP Get request? If so, how?

If I still have questions after this, I will use the support ticket.


Solution

  • I've seen a few integrations done this way-- usually in a server-side language like PHP, JSP, or ASP. Depending on what server-side technology you're using, where these variables come from is going to look different. The UA (user agent string) and the UIP (user's external IP address) usually comes from an inbound HTTP request headers. PHP, for instance, has a variable called $_GET for retrieving these parameters so you can pass them onto your Millennial API call. In these cases, it's acceptable but not optimal to pass the same value for AUID as you do for UIP. Then, you can echo out the response of your call to Millennial onto the webpage on its way into your app.

    On the other side, if you're trying to build this into your Android app ("client-side")-- getting the AUID is as easy as calling Secure.getString(this, Secure.ANDROID_ID); and UA and UIP can be omitted since your WebView object will populate them in their request headers, and Millennial's servers will be able to recognize them.

    If you'd like more guidance (since Stack Overflow is more of a Q&A environment and not a discussion board), I recommend putting in a support ticket at https://tools.mmedia.com/user/supportDevPortal