I am trying to integrate 'reward for invites' logic. What I am trying to do for this is I generate a unique URl for every user. When a friend clicks on the URL he is directed to a page and then to the playstore. On the page, a cookie with the unique id is stored on the device.
Note - (User may open the link in any browser)
When the app on the device starts, I fetch for the cookies that was saved using above and if available send the same to the Server where the user is easily identified and rewarded.
This looked pretty straight forward, however I am stuck at the point where I have to read the cookie and extract the id.
I read this which says it isn't possible. :( I also tried the below
List<Cookie> cookies = new DefaultHttpClient().getCookieStore()
.getCookies();
if (cookies.isEmpty()) {
System.out.println("None Cookies");
} else {
for (int i = 0; i < cookies.size(); i++) {
System.out.println("Cookie - " + cookies.get(i).toString());
}
}
but no luck. I keep getting "None Cookies".
My Questions:
- Is it possible to read the cookie that was created? If yes how?
- If no, any alternative on how I can achieve the above functionality?
Thanks for stopping by.