Can we write the action for Home button in iphone - iphone

I am going to develop an application which will be posted in cydia. My requirement is after unlocking the iphone when the user clicks the home button then my application need to be popedup(run) ..
is it possible to do this?
if yes how?

You can do this without any extra code by changing the settings in Activator. The app doesn't need to be in Cydia, either.
Confirm you have Activator installed from Cydia.
Go to the Settings app, followed by Activator.
Choose which environment you want the action to run in: Anywhere, Home Screen, in an app or Lock Screen.
Scroll down to “Home button” and tap the action you want.
Scroll down again, until you see the app you want. Tap it and confirm there is a check mark next to it.
Now your app will start every time the action occurs. If you want this to be automatically set when your app is installed, however, you'll need to include the libactivator header in your code and use its API to set the action. Because the header isn't included with iOS, you'll need to make the app for Cydia.

Related

Android Application: Returning to the activity where you stopped

I've been making a simple android app here, but i'm stuck with a problem. The app is composed of 1 splash(that is the main activity) and 4 other activities(one of them is used to go to the other 3). Whenever i exit my application and resume it with the process manager, it opens the activity i stopped at. But, when i resume it by clicking on the icon, it goes back to the splash activity. Is there any way to make it always go to where i stopped? Any flag or something i can set on the manifest?
This is an Android bug. The standard behaviour is to return to your application (in the same state as when you left) when launching it from the HOME screen. However, if you started your application for the first time from the installer, this gets broken.
To check if you are seeing this behaviour, go to the Settings->Applications and force close your application. Now go to the HOME screen and start your application. Use your application for a bit. Now press the HOME button to return to the HOME screen and launch your application again by clicking on the icon. It should return to your application exactly the way you left it.
See https://stackoverflow.com/a/16447508/769265 for more information and other links to this long-standing and nasty Android bug.

iPhone - Sending the app to the background

In my app, when it runs for the first time, it shows a UIViewAlert and offers you to see the preferences for the app - and the user has 2 choices - yes or no. If the user hits no the alert fades away and the application continues running. I want to set it in such a way, that if the user hits yes, my app will go to the background, the settings tab of the app will be opened (I added a settings bundle to the app). Is it possible to do such a thing? Thanks!
No, this is not possible. But you can create a settings view in you app and show it instead of trying to open the settings app.
Normally, you do want to encourage users to use your app as long as possible, and making them quit your app yourself is not the best way to achieve that.
No, this isn't possible.
But you could use InAppSettingsKit and modally show a view controller with the settings inside the app.
You can find out more here - http://www.inappsettingskit.com/

App running in background despite plist saying not to

In my appname-Info.plist
I have 'Application does not run in background' box checked.(it is ticked)
But when i press the button under the screen to close the app, and then double press the button it shows the list of apps and my app is there among the list of currently running apps. Does this mean that my app is running in the background?
If so is there a fix for this? I'd like to make sure my app is completely dead when user quits it.
Thanks
-Code
Your app is not running in the background after you close it.
Even if you see it in the switcher app list.
Application has different states
Active
InActive
Running in Background
Your application become in-active, not running in background.
Aplications are allaowd to run in the background only for:
Playing music.
Navigation needs.
VOIP (as Skype).
And you should explicitly ask the permission and set the appropriate code for doing that and not only check the 'Application does run in background' in the info.plist
The list you get when you double tap the home button is not a running applications list. That's a common misconception. It's actually a list of recently launched applications. Therefore it makes sense for your app to be in it even if it doesn't multitask.

What does double-tapping on the home button exactly do?

What does double-tapping on the home button exactly do?
Does it list the applications running in background, OR
Does it list recently used applications?
I've implemented the "Application does not run in background" in my Info.plist file. In spite of this my application shows on double tapping the home button !! Yes I have tried a clean build.
It shows all recently-used apps, not just the multi-tasking ones. If you try to tap your app now, it will start exactly like it was first launched, displaying the launch image first before initializing (calling application:didFinishLaunchingWithOptions: and sending the relevant notifications).

Reinitializing iPhone app when it relaunches

I am building an iPhone app. Currently when I close the app and relaunch it, it relaunches on the last viewed view. Instead I want to be able to reinitialize the app, and present the view that's most appropriate for the application's state (based on what's in the database).
How can I do that?
You have two options. You can follow Petesh's suggestion to make your app always terminate, or you can implement -applicationWillEnterForeground in your app delegate and reset things there.
I presume it's iOS4 - your app is not being terminated in this case, it is merely being suspended.
You need to follow the instructions here: http://maniacdev.com/2010/07/screw-multi-tasking-how-to-make-your-ios-4-apps-exit-for-real/ which will terminate the app when the user presses the home button.
You need to add the appropriate 'correct view' logic to your application's start-up code once you've done this.
For the purposes of expediency, I'm adding the instructions here:
Open your info.plist file
Add The Key UIApplicationExitsOnSuspend or Select Application does not run in background
Set the new key to YES or Fill in the tick box