にnullを返し、私はそのようなマニフェストでそれを宣言した:getApplicationContextは()私はそれ自身のプロセスでのサービスを持っているサービス
<service
android:name="com.discountscatcher.util.PointService"
android:configChanges="orientation"
android:process=":pointservice" >
</service>
しかしonStartCommand
、私はそれが常にApplicationContext
を取得しようとしたが、 nullを返します。何が忘れることができますか?
public int onStartCommand(Intent intent, int flags, int startId) {
android.os.Debug.waitForDebugger();
Context mContext = getApplicationContext();
return Service.START_STICKY;
}
と私はそのようにそれを開始:Myactivity OnCreate
任意のアイデアで
startService(new Intent(getApplicationContext(), PointService.class));
?
をチェックするにはプロセス間通信である http://developer.android.com/guide/components/processes -and-threads.html#IPC –
サービスはコンテキストです。なぜアプリケーションコンテキストが必要ですか? – FunkTheMonk
@FunkTheMonkどのように文字列、drawablesなどのアプリケーションリソースを取得できますか? – whizzzkey