1

我可以在不调用 startService 的情况下调用 bindService 吗?如果是这样,它是否还会在我的服务中调用我的 onCreate 方法?

  public static void bindMusicService(Context c){
        /*mediaPlayerServiceIntent binds our connection to the MediaPlayerService. */
        mediaPlayerServiceIntent = new Intent(c, MediaPlayerService.class);
        c.bindService(mediaPlayerServiceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
        mServiceIsBound = true;
        Log.i("Main","Service is bound!");
    }
4

0 回答 0