Android service boot start running 2.3 but not running 4.0
please help me!
Alow to you help me..app android start boot complete running 2.3. but not
running 4.x
code: BroadcastReceiver
@Override
public void onReceive(final Context context, Intent intent) {
Log.v(TAG, "try to start service out");
try{
if
("android.intent.action.BOOT_COMPLETED".equals(intent.getAction()))
{
Log.v(TAG, "try to start service");
ComponentName comp = new
ComponentName(context.getPackageName(),
LocationService.class.getName());
// Wait 10 s to ensure all the service run ok
try {
Log.v(TAG, "try to start service - sleeping");
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.v(TAG, "exception");
e.printStackTrace();
} catch (Exception ex) {
Log.v(TAG, "exception" + ex.toString());
}
ComponentName service = context.startService(new Intent()
.setComponent(comp));
Log.v(TAG, "started the service");
if (null == service) {
// something really wrong here
Log.e(TAG, "Could not start service " + comp.toString());
}
} else {
Log.e(TAG, "Received unexpected intent " + intent.toString());
}
}catch (Exception e) {
// TODO: handle exception
Log.v("Start","Error");
}
}
in android AndroidManifest setting focus to sevices
No comments:
Post a Comment