detect which is the current running application in device in iOS. - ios

Is there any possible way to track which application is running in foreground in device in iOS.
For example if I am using facebook app I need to get the name of the application from my application.
If SMS application is used I need to get the name of the application from my application.

It's not possible. All you can do is get a list of currently running tasks using a systcl call.

Related

Leaflet.js localization request text on iPhone

When I deploy my leaflet app to ios, the system asks me whether the user trusts application /private/var/mobile/Containers/bundle/Application/BLABLABLANUMBERS234234/www/index.html
to use the current location?
How can I
Replace the path with the application name?
Save the decision for the future? It keeps asking me every time when I start the app.
I guess Android would be similar?
Thanks
EL

currently which app is being used by iphone user

In my app, Can I check that which app is being used by a user right now, while my app is running in background?
If so, Is there any API available to get that info?
thanks in advance!
No. There's no public API that lets you a background app find out about the foreground app, or get a list of running apps, or anything like that.
The only mechanism for finding out about other apps on the device is +[UIApplication canOpenURL:], which you can use in some cases to find out whether a specific custom URL scheme can be handled. From that you can often guess that a particular app is installed, although the method really only tells you that some app that can handle the given scheme is installed. However, you still can't find out if that app is the foreground app, or even if it's running at all.

How to resume your app using calaba.sh

I'm using Calaba.sh to to ui testing of my iOS app. I want to be able to test tapping on a link in the app which takes the user to a web address in their browser. I then want to be able to resume the app. Is there a way to do this?
This is not possible in Calabash iOS.

Modal Application

I'm using Xamarin.Android and I would like to build an application that start in modal way and don't close if you push the home button.
So this application need to be the only one application than a user can use on device.
Somebody can suggest how it can be done?
You best way to do is to make a "Launcher"/"Home" application. The Android SDK comes with a sample on how to do this.
You basically do this by adding your main Activity to the android.intent.category.HOME and android.intent.category.DEFAULT category and you set the launchMode to singleInstance.
This will register it as a Home application, then when you press your home button it should ask you to choose which launcher you want to use. You will have to set it once and it can be changed by the user.
You can find the sample in: android-sdk\samples\android-17\Home\src\com\example\android\home (should also be available in the other API samples).
You cant stop people from installing applications on android devices. You would have to build your own hardware for that however, you can override OnKeyTouch and check for the key being home.
You could build a service that checks the package of each running application and log which applications are run on the device to prevent users from using company property on other things. However, if android ever decides to kill your application the service should stop and this wont work.
Long story short what you are trying to do is flawed in its inception given the platform you are trying to do it on.

Create equivalent of Androids sync adapter on iOS

I got data on a webserver which I want to download to an iOS contact list. Is it possible to programatically create an account on iOS that works like the android "sync adapter" and is not one of the default account or an LDAP/CardDAV account?
Or can I have my application to periodically chech for updates on my webserver without the user having to manually start it. (i.e. running in the background and starting up automatically when the phone is restarted)
No, to both. The best you can do is create a configuration profile that the user can download to add an LDAP/CardDAV account—but you will need to run an actual LDAP or CardDAV server to have any kind of automatic contact syncing happen without the user opening your app. The Address Book framework on iOS only allows you to add and modify contacts within the existing accounts on the device, and the multitasking rules only allow your app to start in the background if it provides a VoIP service.
Use silverstripe-sync !
Source: SO

Resources