2013年4月27日土曜日

[AndroidSDK]ServiceのbindService()でfalseが帰る

Intent intent = new Intent(this, MyService.class);
boolean result = bindService(intent, mConnection, Context.BIND_AUTO_CREATE);.

でfalseが返ってくる

StackOverflowによると

Android Context.bindService always returns false and ServiceConnection object is never triggered
(bindServiceでfalseが返ってきてServiceConnectionが動かねえよ)


getApplicationContext().bindService()でいけるぜ、
この回答で動いた人がおおいみたいだが、今回はどうも違うようだ。

結論
Manifest.xmlで
<service android:name=".MyService" />
となっていたが、パッケージが間違っていた
<service android:name="Utility.MyService" />

0 件のコメント:

コメントを投稿