iOS - Cydia open command and its counterpart?
Asked Answered
M

2

0

There is a Cydia command line utility called open which will open an iOS application and attach to the SpringBoard.

Is there a corresponding close command which will send the correct signal to the application ? It needs to send the correct signal so that it will do the necessary cleanup before terminating. The kill command cannot be used as the application is not able to catch the signal.

I have been searching high and low for this particular command line tool but yet to find it.

Thank you.

Mycenae answered 11/3, 2013 at 8:12 Comment(1)
Did Nate's answer help you at all? It's common to either accept the answer or mark up/down and give appropriate feedback.Cogitation
E
0

Have you tried using

killall MobileCydia

should work

Exchangeable answered 25/3, 2013 at 13:30 Comment(1)
I am looking for a command line tool that can accept a command line with the sane effect as going to the background app selector (double click home button) and removing a specific app from the selector (hold on app and click the minus sign). This manual prcocess seems to send an appTerminate signal to the app, which the kill command does not send.Mycenae
F
0

I don't know of any such command, but you could certainly build one yourself that simulates a home button press. That should close the open app the normal way. It's not an abnormal kill. If the app supports multitasking, it'll go to the background, with all the normal UIApplicationDelegate callbacks along the way.

  1. Build a non-graphical iOS application. Just strip the UIApplicationMain() call out of main.m

  2. Link your application against GraphicsServices.framework. It's a private framework, so in the Xcode Build Phases settings window, where you normally choose frameworks to link against, you won't see it in the public list. Navigate on the file system to the Private Frameworks folder (e.g. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/PrivateFrameworks) and pick it.

  3. You'll need to generate headers for GSEvent.h (and probably GSWindow.h, which it #includes). Here you can find a copy of both. Add them to your project, and #include GSEvent.h in your main.m file.

  4. Use this function:

#include "GSEvent.h"

- (void)simulateHomeButton
{
   struct GSEventRecord record;
   memset(&record, 0, sizeof(record));
   record.type = kGSEventMenuButtonDown;
   record.timestamp = GSCurrentEventTimestamp();
   GSSendSystemEvent(&record);
   record.type = kGSEventMenuButtonUp;
   GSSendSystemEvent(&record);
}

This code should be usable as a method to close the current app (i.e. the code runs inside the UIApplication that's in the foreground), or another open app (as would be the case for building a command line utility).

Hattip to libActivator for the idea.

Feme answered 14/4, 2013 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.