Saturday, 15 August 2015

android - Use 0 or BIND_AUTO_CREATE for bindService's flag -



android - Use 0 or BIND_AUTO_CREATE for bindService's flag -

by referring bindservice (intent service, serviceconnection conn, int flags)

may know, when should utilize 0 flags, , when should should utilize bind_auto_create flags? documentation doesn't explain meaning of 0 flags.

example using 0 flags // start auto finish service. autocompleteserviceintent = new intent(autocompleteservice.class.getname()); startservice(autocompleteserviceintent); bindservice(autocompleteserviceintent, serviceconnection, 0); example using bind_auto_create flags mcontext.bindservice(new intent("com.android.vending.billing.inappbillingservice.bind"), mserviceconn, context.bind_auto_create);

for method bindservice(intent, serviceconnection, flag) if flag context.bind_auto_create used bind service , start service, if "0" used, method homecoming true , not start service until phone call startservice(intent) made start service. 1 of mutual utilize of "0" in case activity connect local service if service running, otherwise can start service.

android

No comments:

Post a Comment