whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
forumadmin  
#1 Posted : Monday, November 16, 2009 10:15:06 PM(UTC)
forumadmin
Rank: Administration

Groups: Administrators, Registered
Joined: 7/9/2009(UTC)
Posts: 33




/**
* Determines status of device's IMEI.
*
* @return -1 - imei status retrieval failed. 0 - Green status 1 to 3 - Yellow
* status 3 to 5 - Brown status above 5 - Red status
*/
public int getIMEIStatus()
{
// 1. Get device ID
TelephonyManager manager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String sDeviceID = manager.getDeviceId();
// 2. Fetch for IMEI data.
// Will look like
// http://www.artfulbits.co...shx?IMEI=123456789123456
String url = "http://www.artfulbits.com/android/antipiracycheck.ashx?IMEI="
+ sDeviceID;
// Server will return 200 if request post was successful.
int http_ok = 200;
// Create new http client.
HttpClient client = new DefaultHttpClient();
// Create new http post.
HttpPost post = new HttpPost(url);
// Cache http response.
HttpResponse response = null;
// Will return -1 unless server provides its own value.
int imeiStatus = -1;
try
{
// Executind post.
response = client.execute(post);
// Making sure we've received correct status code.
if(response.getStatusLine().getStatusCode() == http_ok)
{
// Retrieving content stream.
InputStream stream = response.getEntity().getContent();
// Decorating stream with Input stream reader
InputStreamReader isr = new InputStreamReader(stream);
// Decorating input stream reader with buffered stream reader.
BufferedReader reader = new BufferedReader(isr);
// Reading imei status from stream.
imeiStatus = Integer.parseInt(reader.readLine());
// Closing buffered reader will recursively close decorated input stream
// reader and input stream.
reader.close();
}
}
catch(Exception e)
{
e.printStackTrace();
}
return imeiStatus;
}

Edited by user Wednesday, November 18, 2009 9:47:02 PM(UTC)  | Reason: Not specified

ArtfulBits Support Team
Join us on Facebook, Linkedin
Be SharePoint! Be Mobile! Be ArtfulBits!
forumadmin  
#2 Posted : Wednesday, November 18, 2009 9:44:06 PM(UTC)
forumadmin
Rank: Administration

Groups: Administrators, Registered
Joined: 7/9/2009(UTC)
Posts: 33

ArtfulBits Support Team
Join us on Facebook, Linkedin
Be SharePoint! Be Mobile! Be ArtfulBits!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2017 ArtfulBits. All rights reserved.