serviceconnection

MainActivity has leaked ServiceConnection android.speech.SpeechRecognizer$Connection@414ee400 that was originally bound here

无人久伴 提交于 2019-12-01 14:59:16
问题 In my app I recognize the user saying "exit" or "close" and the app should close. With this code SpeechRecognizer sr; Map<String, Integer> dictionary; private static final int EXIT = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); populateDictionary(); SpeechRecognizer sr = SpeechRecognizer.createSpeechRecognizer(this); sr.setRecognitionListener(this); Intent voiceIntent = RecognizerIntent

LicenseChecker checkAccess leaks ServiceConnection

末鹿安然 提交于 2019-12-01 02:51:45
I am receiving this exception in LogCat every time I press the Back button in my app: Activity has leaked ServiceConnection com.android.vending.licensing.LicenseChecker@471cc039 that was originally bound here The code responsible for this leak in onCreate() is: mLicenseCheckerCallback = new MyLicenseCheckerCallback(); mChecker.checkAccess(mLicenseCheckerCallback); How do I get rid of this leak? I tried not assigning MyLicenseCheckerCallback to a member, thinking perhaps when the activity goes onPause() the reference to the callback is responsible for the leak: mChecker.checkAccess(new

Activity <App Name> has leaked ServiceConnection <ServiceConnection Name>@438030a8 that was originally bound here

谁说胖子不能爱 提交于 2019-11-28 02:53:16
I'm working on my first Android app. I've got three activities in my app, and the user switches back and forth pretty frequently. I've also got a remote service, which handles a telnet connection. The apps need to bind to this service in order to send/receive telnet messages. Edit Thank you BDLS for your informative answer. I have re-written my code in light of your clarification on the difference between using bindService() as a stand-alone function or after startService() , and I now only get the leak error message intermittently when using the back button to cycle between activities. My

Do I need to call both unbindService and stopService for Android services?

时光怂恿深爱的人放手 提交于 2019-11-27 13:00:07
问题 In my Android app, I call both startService and bindService : Intent intent = new Intent(this, MyService.class); ServiceConnection conn = new ServiceConnection() { ... } startService(intent) bindService(intent, conn, BIND_AUTO_CREATE); Later, I attempt to both unbindService and stopService`: unbindService(conn); stopService(intent); However, I get an exception on the call to unbindService . If I remove this call, the app seems to run properly through the stopService call. Am I doing something

Android how do I wait until a service is actually connected?

邮差的信 提交于 2019-11-27 11:33:25
I have an Activity calling a Service defined in IDownloaderService.aidl: public class Downloader extends Activity { IDownloaderService downloader = null; // ... In Downloader.onCreate(Bundle) I tried to bindService Intent serviceIntent = new Intent(this, DownloaderService.class); if (bindService(serviceIntent, sc, BIND_AUTO_CREATE)) { // ... and within the ServiceConnection object sc I did this public void onServiceConnected(ComponentName name, IBinder service) { Log.w("XXX", "onServiceConnected"); downloader = IDownloaderService.Stub.asInterface(service); // ... By adding all kinds of Log.xx

Activity <App Name> has leaked ServiceConnection <ServiceConnection Name>@438030a8 that was originally bound here

空扰寡人 提交于 2019-11-27 04:59:26
问题 I'm working on my first Android app. I've got three activities in my app, and the user switches back and forth pretty frequently. I've also got a remote service, which handles a telnet connection. The apps need to bind to this service in order to send/receive telnet messages. Edit Thank you BDLS for your informative answer. I have re-written my code in light of your clarification on the difference between using bindService() as a stand-alone function or after startService() , and I now only

Android how do I wait until a service is actually connected?

寵の児 提交于 2019-11-26 15:37:26
问题 I have an Activity calling a Service defined in IDownloaderService.aidl: public class Downloader extends Activity { IDownloaderService downloader = null; // ... In Downloader.onCreate(Bundle) I tried to bindService Intent serviceIntent = new Intent(this, DownloaderService.class); if (bindService(serviceIntent, sc, BIND_AUTO_CREATE)) { // ... and within the ServiceConnection object sc I did this public void onServiceConnected(ComponentName name, IBinder service) { Log.w("XXX",