How to show rate this app message on dashboard - iphone

Is it possible to use appirater, iRate or other method to show "rate this app" message when user go back to dashboard. I tried to use appirater in applicationdidenterbackground. But the message didn't show.

When your application is going to background the popup won't be visible for a user - it will be shown within your app. You can show it when user goes back to your app using:
- (void)applicationWillEnterForeground:(UIApplication *)application

Related

iphone home button event

I am developing a iPhone application and would need to track the home button pressed event by user while the app is in background mode.I have go through the apple documentation/apis but could not find out any to track.
It would be great if anyone can help me on this to track the iPhone home button pressed event.
Your application can't catch any events while in the background. There are some special cases which allows your app to do some tasks in the background, but even them wouldn't allow you to listen to Home button interaction.
You cann't track the home button pressed or not but as your situation is to see if application went in background or not. for this there is a method applicationDidEnterBackground:(UIApplication *)application. This method is called as the application enters into background.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSLog(#"Application Entered Into Background.");
}

What code is required to launch an iPhone app after a local notification has been scheduled and displayed?

I am scheduling a local notification which is firing fine. I need to know how to allow a user to launch my app after the notification has been displayed on screen.
I also need to know how to identify this type of launch to direct the user to a specific view, relevant only to users who have arrived as a result of the notification.
I have been looking at the UIApplicationDelegate protocol reference and feel it could be in the area of the launchOptions within -didFinishLaunchingWithOptions:, but need a little pointer.
Your application will launch automatically, you don't have to do anything in the app itself for that to happen.
If that's not already happening, check that you've specified an alertAction for the notification when you create it - that's the label of the button in the notification alert that opens your app and if you don't set it, the notification alert won't launch the app.
To open a specific view, use the launchOptions and the application:didReceiveRemoteNotification method.
didFinishLaunchingWithOptions: would do the trick.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
// .. etc
};
Keep in mind you also need to implement
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
if you receive a push notification while the app is running (fore- or background)
The launch options should contain the key UIApplicationLaunchOptionsLocalNotificationKey which in turn gives you the UILocalNotification associated with the notification. Additionally, when scheduling the notification your UILocalNotification has the properties alertBody, alertAction and optionally alertLaunchImage which control the information being displayed. The action decribes the button text that launches your app while the body is the information being deisplayed above the buttons. You can supply a specific launch image for this launch to mimic the app already being run.
Also note Bogatyr's answer concerning the cases where your app is not being launched but already there, just suspended.

Can i get info about notification (apn)

Can I get list of push notifications (APNS notifications) for my app when app became from background to foreground mode?
In foreground mode i can receive info about push notification in callback
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Other case:
My app receive push notification, when app in background mode.
After this i click on app icon, and i want to get info about received notification. How can i get this info?
If i click directly on the notification (not on app icon), in background mode, then callback didReceiveRemoteNotification is call.
Can I get list of push notifications (APNS notifications) for my app when app became from background to foreground mode?
No. There is no list. You can only get one notification at once. When the users iPhone is offline and you send 5 notifications the user will only get the last one you have send.
If the user starts your app using the open action on the notification you will get it on start using:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Other Case
My app receive push notification, when app in background mode. After this i click on app icon, and i want to get info about received notification. How can i get this info?
You can't. When the user closes the notification and opens you app later it is already gone and there is no way to access it.
When you send push notifications you probably have a server reachable over the internet, where you register the devices of the user.
The usual way to handle this is to store the notifications on this server and query it on app launch... so use the notification just to notify the user to start your app and then check your server on launch of the app for whatever you want.
Once your application reaches foreground and actively running, the notification alerts like sound, alert won't be displayed or you wont be notified.
But you will get a call back in the UIApplication Delegate that you can make use of it.
The api is,
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
And, if your application is running in background, then the notification appears and only when you click on "View" button, you will get the call back in UIApplication delegate.
If you click on Close button, you won't get the call back in the application.

iPhone app login issue

I have an iPhone application which I'm working on and so far i have created a login page for the application such that only the phone's user can access the application. The login works fine and the application works fine, but when i hit the home button, the app is "minimized". And if accessed again from the task switcher it doesn't prompt for a password.
What exactly would be the best way to go about getting the app to request a password. If it helps i use navigation controllers and i have one view dedicated for the login.
Thanks for the help.
Can't you check app activated in the appdelegate?
- (void)applicationDidBecomeActive:(UIApplication *)application {
[self showLoginWindow];
}
You must be working on iOS4. When you hit on Home Button, your app goes into background mode, but still working. So next time, when you open it, it starts exactly from where you left it. Implement the
- (void)applicationDidBecomeActive:(UIApplication *)application
method, to check for login again. Or if you don't want the background processing at all, disable it or use following code
- (void)applicationDidEnterBackground:(UIApplication *)application {
exit(0);
}
EDIT -
Don't go for exit(0) approach, simply disable the background processing if you don't want it from info.plist file.
see this link
you need to prevent the app to load from background.

change Badge and push notification in iPhone SDK

I tried the push notification tutorial . It's working fine but problem is badge. When I click on the view, app is appear and the close it. it still red badge in app icon. How to remove it ?
Another question is
when I click the view, it will appear home screen. I want to show other view when coming from push notification.
This will reset the application badge number. If you set that value to zero, it will hide the badge.
[UIApplication sharedApplication].applicationIconBadgeNumber = iCount;
To handle your push notification with a separate view, you need to handle the following message in your application delegate:
- (void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo
You can access the userInfo dictionary to get additional information about the push notification that resulted in the message callback.