-1

Hi am doing beacon ranging application, here continuously i need run my service in background,while running service my foreground application server api cals taking time to respond,after send request and getting response in middlle am getting some service bluetooth related logs..like below

onScanResult() - Device=20:CD:39:A1:4F:65 RSSI=-68 stopLeScan()

please can u any one suggest me how to cal webservices fast responsive with out stop service running,and bluetooth enable

radha
  • 192
  • 1
  • 2
  • 13

1 Answers1

0

By default Service in Android is executing in main thread. Try to execute service in separate thread.

This may help you: http://developer.android.com/training/run-background-service/index.html

Boban S.
  • 1,662
  • 13
  • 16
  • Thank you i am creating one thread in side run() am calling sercice but same prblem coming – radha Nov 05 '14 at 13:23
  • new Thread() { public void run() { BeaconStreamApplication myEntrypoint = new BeaconStreamApplication(getResources().getString(R.string.app_name), Home.this, "com.beaconstream.com", "9876543211", "1234567891", "Wa96IhgkrHzcqacITPRe6Wuz3", "3oQtNmonUTwtayOOomR2Vk0y1rfhViw4qRBVxXuYGznDJ76j9K", "1440791", user_id, R.drawable.app_icon); } }.start(); i did like that – radha Nov 05 '14 at 13:24
  • Why not google a bit? :) Try other solutions, running only part of service in separate thread. http://stackoverflow.com/questions/19556752/android-how-to-run-service-in-different-thread-than-main-thread – Boban S. Nov 05 '14 at 13:35