OpenFeint Notifications from the bottom - iphone

I have both game center and open feint integrated into my app. When the notification comes up to tell you that you successfully logged in, the open feint overlaps the game center notification. How do you move the notification to the bottom instead. I saw the documentation but I can't for the life of me figure out how to get it to work. I see the enum ENotificationPosition and it includes ENotificationPosition_BOTTOM but where am I supposed to put that code to make it work.

All you need to do is specify this in the settings dictionary that you use to initialize OpenFeint. For example,
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationPortrait], OpenFeintSettingDashboardOrientation,
kShortAppName, OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:NO], OpenFeintSettingAlwaysAskForApprovalInDebug,
[NSNumber numberWithBool:YES], OpenFeintSettingGameCenterEnabled,
window, OpenFeintSettingPresentationWindow,
[NSNumber numberWithInt:ENotificationPosition.ENotificationPosition_BOTTOM_LEFT], OpenFeintSettingNotificationPosition,
nil];
[OpenFeint initializeWithProductKey:kOFProductKey
andSecret:kOFProductSecret
andDisplayName:kLongAppName
andSettings:settings
andDelegates:delegates];

Related

How to create badge number with parse on ios device?

I'm try to create the push notification on my app, and using this script paste on application didReceiceRemoteNotification function:
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
messageContent, #"alert",
#"Increment", #"badge",
nil];
PFPush *push = [[PFPush alloc] init];
[push setChannel:chatRoomName];
[push setData:data];
[push sendPushInBackground];
But, I just can show the push message, there are no badge number show on my app right corner.. what's causing the problem?
for setting badge number you need to refere below url. that will give your required ans.
change Badge and push notification in iPhone SDK

How to Record Audio in iPhone SDK [duplicate]

I want to record audio in my iPhone app and once the audio is recorded I want a dialog box to open which asks for the filename.
And then I want to save the audio with that filename into my app. How can I do so?
try using AVAudioPlayer and AVAudioRecorder classes for audio recording and playback.Initially you have to establish an audio session using AVAudio session class
AVAudioSession *audioS =[AVAudioSession sharedInstance];
[audioS setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
[audioS setActive:YES error:&error];
NSURL *url = [NSURL fileURLWithPath:#"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 2],AVNumberOfChannelsKey,[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
and then initialize the recorder and player classes...Hope this helps
Look at Apple's SpeakHere sample app, available on their iOS developer site.
you can see this question How do I record audio on iPhone with AVAudioRecorder? , which is pretty similar to your question or watch this sample code from apple http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html

iOS: Displaying currently played track info in LockScreen?

As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter, but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem... The problem is that MPMusicPlayerController is used to play iPod Music only, and not locally stored files. Is there a way around this in iOS 5?
You can create your own NSDictionary and supply that to the MPNowPlayingInfoCenter.
NSArray *keys = [NSArray arrayWithObjects:MPMediaItemPropertyAlbumTitle, MPMediaItemPropertyArtist, ..., nil];
NSArray *values = [NSArray arrayWithObjects:#"Album", #"Artist", ..., nil];
NSDictionary *mediaInfo = [NSDictionary dictionaryWithObjects:values forKeys:keys];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mediaInfo];

How to record audio through an iPhone app?

I want to record audio in my iPhone app and once the audio is recorded I want a dialog box to open which asks for the filename.
And then I want to save the audio with that filename into my app. How can I do so?
try using AVAudioPlayer and AVAudioRecorder classes for audio recording and playback.Initially you have to establish an audio session using AVAudio session class
AVAudioSession *audioS =[AVAudioSession sharedInstance];
[audioS setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
[audioS setActive:YES error:&error];
NSURL *url = [NSURL fileURLWithPath:#"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 2],AVNumberOfChannelsKey,[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
and then initialize the recorder and player classes...Hope this helps
Look at Apple's SpeakHere sample app, available on their iOS developer site.
you can see this question How do I record audio on iPhone with AVAudioRecorder? , which is pretty similar to your question or watch this sample code from apple http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html

OpenFeint is on only half of the screen

I'm trying to implement OpenFeint in my Cocos2D iPhone game, but here's something weird that I didn't find how to solve.
Here's how OpenFeint looks like when I initialize it:
http://img842.imageshack.us/img842/8564/screenshot20100926at520.png
And here's the code of the initialization:
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft], OpenFeintSettingDashboardOrientation,
#"NAME", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:NO], OpenFeintSettingEnablePushNotifications,
[NSNumber numberWithBool:YES], OpenFeintSettingAlwaysAskForApprovalInDebug,
[NSNumber numberWithBool:YES], OpenFeintSettingDisableUserGeneratedContent, nil];
[OpenFeint initializeWithProductKey:#"PRODUCTKEY" andSecret:#"SECRET"
andDisplayName:#"NAME" andSettings:settings andDelegates: [OFDelegatesContainer containerWithOpenFeintDelegate:self]];
[[CCDirector sharedDirector] runWithScene: [MainMenuScene node]];
I've seen your post in a few places as I was having the same problem as you were. I just figured out a potential solution for you and thought I would reply. It seems that on some occasions OpenFeint is unable to access the keywindow and in that case creates it's own window that may not act as yours has been set up to do. The solution is to let OpenFeint know specifically which window to go after by adding it to the settings. My settings are below and as you can see I added the "OpenFeintSettingPresentationWindow" Setting with my keyed window. After doing this it worked wonderfully. Hope this helps!
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
window, OpenFeintSettingPresentationWindow,
#"ComingSoon", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
nil];
Chances are you have the wrong settings bundle for orientations in your binary, delete landscape and add the iPhone universal settings bundle.
I'm not sure specifically what the problem is, but it looks like OpenFeint is trying to display in landscape but is somehow being rotated as if it was in Portrait mode. Can oyu double check to make sure your orientations are correct for both your app's primary view controller (or however you configure it in Cocos2D). And that OpenFeint is aware of it as well?
In cocos2d,the window just need to refer to the window in applicationDidFinishLaunching.