Friday, March 19, 2010

Android Stock Alerting Application

AlienHive Labs just released its first application - Stock Price Alerts.

What is Stick Price Alerts?
Stock Price Alerts is a simple and easy to use application that notifies you when a stock has hit it's configured low or high price. How you ask? After you setup your stock list (ticker, low/high prices, and enable notifications) you can enable the alerting system to automatically update your stock list. The alerting system will run in the background pulling data from the Internet. A notification will be sent once a stock has hits its low or high price.

More information: http://sites.google.com/site/alienhivelabs/

Tuesday, March 2, 2010

Android Indicates whether the specified service is already started

/**
* Indicates whether the specified service is already started.
* This method queries the activity manager for launched services that
* can respond to an binding with an specific service name.
* If no existed service is found, this method returns null.
*
* @param context The context of the activity
* @param className The service full name to check for availability.
*
* @return ComponentName if the service is already existed, NULL otherwise.
*/
public static ComponentName isServiceExisted(Context context, String className)
{
ActivityManager activityManager = (ActivityManager)context.getSystemService(ACTIVITY_SERVICE);
List serviceList =activityManager.getRunningServices(Integer.MAX_VALUE);

if(!(serviceList.size() > 0))
{
return null;
}

for(int i = 0; i < serviceList.size(); i++)
{
RunningServiceInfo serviceInfo = serviceList.get(i);
ComponentName serviceName = serviceInfo.service;

if(serviceName.getClassName().equals(className))
{
return serviceName;
}
}

return null;
}