iOS - Trigger click events outside of the app - like in app drawer - ios

How can you trigger touch and type events outside of your app. I already have created a service that can collect certain data but I can't trigger clicks.
P. S. My requirement is to have a device cloud hosted on the internet and allow people to access them remotely

This is not possible. Apple would never allow such a huge security risk.
You misunderstand how Seetest works. Seetest requires access to your App's binary code, which it instruments:
https://docs.experitest.com/display/public/UFT/iOS+Applications
It then simulates user events by calling event handling methods, e.g. #IBAction handlers. It does not go to the low level that you want, because nothing can unless you violate Apple's usage rules.
EDIT
I was assuming you wanted to write an iOS App that could generate events outside of its sandbox. Instead I think you're referring to Instruments which is controlled by a host.
Because this is a general question, see if this gets you in the right direction:
https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html

I have managed to do this using Appium java API. First launch a dummy app, then call driver.back() and from there, you will have full control

Related

Possible to present UIViewController from another app?

This may seem overly ambitious, but I'm exploring the ability to present a view controller from one app in a separate app (both authored by me). I'm not talking about reusing a class, I'm referring to literally presenting a controller from another process over the foremost one.
I believe this is in the realm of XPC on macOS, and how share extensions currently work on iOS. Unfortunately I'm not looking for a share controller though.
Is this at all possible (even using private APIs if I have to)?
Because both apps are sandboxed by iOS, there is no way for either of them to locate and load (something from) the other. Extensions are the only way provided by Apple to have another app perform some action.
Using private APIs will not lift sandbox restrictions. With a jailbroken device, it would be possible to locate the other app. In that case -[NSBundle loadClassNamed:] would allow you to obtain and instantiate a class from a loaded (application) bundle, but it would still be controlled by the process that instantiated it.
So, no, what you ask is not realistically possible for apps that would be distributed to other users than yourself. If it's just for yourself, you might be able to get somewhere with a lot of work on creating, controlling and communicating between processes on jailbroken devices.
If you have your own server, then this is possible. Just have app1 send a trigger to your server, and then your server sends push notification to your app2. when user tap notification, it will open your app2 viewcontroller.

Listen for iOS device power button presses

I am creating an app, which needs to do something when the user presses the power button 5 times.
I figured out that it's difficult to implement in iOS, but I think it's not impossible. How do I listen for power key events, even when the app is running in the background?
Can anyone help me to find solution?
you can tap a power key once and also you cannot detect the event from your application, this is not possible in iOS as far now, better try a different way to send alert with in your app, set some conditions with in your app and then send a alert based on those conditions if satisfied, I think this would be better,
Somehow ,If you try to override the existing functionality of the power key, apple will reject your app I think so,
You can't directly get the power button events. But there are notifications which you can count like UIApplicationProtectedDataWillBecomeUnavailable or UIApplicationWillResignActiveNotification. Or just register for all low level notifications with CFNotificationCenter and see if you find something fitting like com.apple.springboard.lockstate.
I don't think you can override system level actions like holding the power button, pressing the home button, overriding the mute sound switch within your own app. iOS system doesn't exactly behave like an normal computer OS, it's to much more limited.
Apple is not allowing you to use hardware components completely. They have added some restrictions. They provided the method in the app delegate i.e. applicationDidEnterBackground can catch the home button press .Also they has provided the the API's to access the camera,bluetooth etc .At least this much of API's I know which provided by apple publicly to access the hardware. You cannot access the other hardware elements in your application which not provided publicly by apple .If you are able to do this by any way then also your application will not approved by apple .

iOS - Can an app running in the background send touch / gesture events to another app in the foreground?

I have been asked to develop an app that will record and later "play back" touches and gestures onto another app running in the foreground.
From my experience and knowledge, this is not possible unless both apps are setup to send/receive data between them through notifications or other methods. Also, it would be a huge risk for apps and their data to be exposed to anybody.
I am 99% sure this is not possible, but was just curious if anyone else has come across something similar (or documentation that specifically states this is forbidden).
Nope not possible, no way no how, dont even try.
Expanded answer, if this runs on a jailbroken phone.......
Yes.... but good luck,
check Saurik's Veency code for this sort of functionality, it would have to be refactored signifcantly but basically it allows for virtualization of taps.
https://github.com/iceNuts/TouchTest
http://gitweb.saurik.com/veency.git
if you want to access another application in your iPhone ,you can set the url scheme parameter and so on.You can add callback in your url,then you can return back your application.
It's actually possible with facebook's idb:
https://github.com/facebook/idb/
As it stated:
Remote Automation. idb has a “companion” that runs on macOS and a python client and cli that runs anywhere. This enables scenarios such as a “Device Lab” within a Data Center or fanning out commands to large numbers of iOS Simulators.
As facebook stop support on WebDriverAgent, it's the best option we have right now

How can you detect the native browser shutdown in a Blackberry app?

I've got a Blackberry app (5.0 and above) that I'm making changes to. One feature of the app launches an online banking function in a BrowserField2. I'm investigating a change to the app that would have the online banking function launch in the native browser, using this basic function:
Browser.getDefaultSession().displayPage(myBankingUrl);
The change is mostly motivated by performance -- the BrowserField2 seems a lot slower than the external browser.
My show-stoppper is this: in the existing implementation, I can detect when the BrowserField2 screen is shut down, and I can force the invocation of a logout call. The bank that's associated with the online banking function really really cares about this. I have not yet found any way to hook in to the shutdown of the external browser to port over this piece of functionality. Has anyone tried something like this?
There is no API to detect that. You can listen when your app is activated - if you open browser your app screen is second in stack and becomes first when user closes first. But there is no garante that user will close browser or move to another app (to view incoming sms for example).
I would suggest you to continue with BrowserField2 for 5.0+.
The browser on a BlackBerry is always running. It provides the default push service reception and other required services.

Blackberry - prevent deletion of app

I made an app for parents to put on Their kids phones but need a way to protect against deletion. Any ideas?
There are no ways to do this short of installing a second app to monitor the first. Optionally you could have a web service that requires the app to phone-home at a predefined interval, but that quickly gets more complex than you were likely hoping for.
If the app is deployed via a BES, you can use appropriate application control policies to prevent deletion.

Resources