原因は日付・時刻が正しく無かったためであった。
( しばらく起動してなかったので時刻は1970/1/1 09:00に・・・ )
これを現在時刻に直してから試したら成功した。
[self performSelectorOnMainThread:@selector(updateSlider) withObject:nil waitUntilDone:NO];
ExtAudioFileRead(fileReference, &size, buffer);
for(UInt32 i=0 ; isourceBuffer->mNumberBuffers ; i++){
buffer->mBuffers[i].mDataByteSize = BUFF_SIZE;
}
<PreferenceScreen android:title="Show in market." >
<intent
android:action="android.intent.action.VIEW"
android:data="market://details?id=jp.ne.sakura.ccice.audipo" />
</PreferenceScreen>
<PreferenceScreen android:title="Send an mail to developer." >
<intent
android:action="android.intent.action.VIEW"
android:data="mailto:hogehoge@foo.com" />
</PreferenceScreen>
<PreferenceScreen android:title="Share this app." >
<intent
android:action="android.intent.action.SEND"
android:mimeType="text/plain" >
<extra
android:name="android.intent.extra.TEXT"
android:value="Texts to share." />
</intent>
</PreferenceScreen>
ComponentName myEventReceiver = new ComponentName(getPackageName(), MusicIntentReciever.class.getName());
AudioManager myAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
myAudioManager.registerMediaButtonEventReceiver(myEventReceiver);
myAudioManager.requestAudioFocus( new OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
Log.d(TAG, "focusChanged:"+focusChange );
}
} , AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
// build the PendingIntent for the remote control client
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(myEventReceiver);
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);
// create and register the remote control client
mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
myAudioManager.registerRemoteControlClient(mRemoteControlClient);
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
mRemoteControlClient.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_PLAY |
RemoteControlClient.FLAG_KEY_MEDIA_PAUSE |
RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
RemoteControlClient.FLAG_KEY_MEDIA_STOP);
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
mRemoteControlClient.editMetadata(true)
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, "a")
.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, "b")
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, "c")
.apply();