Skip to content

静默安装,卸载,打开APP,进程通信,后台保护

Notifications You must be signed in to change notification settings

LZRight123/KPAppMananger

Repository files navigation

功能

  • 静默安装APP,卸载,打开,监听。
  • 进程间通信。
  • 获取设备UDID。
  • 后台保活。

集成

  • 直接使用
pod 'KPAppMananger', :git => 'https://github.com/LZRight123/KPAppMananger.git'
  • clone到本地
git clone https://github.com/LZRight123/KPAppMananger.git
pod 'KPAppMananger', :path => '../KPAppMananger'

用法

  • 获取设备UDID
[KPAppTool UDID]
// 获取设备信息,包括UDID 本机名称 机身颜色 等
[KPAppTool deviceInfo]
  • 后台保活 Signing & Capabilities -> BackgroundModes -> Audio
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[KPBackgroundTaskUtils sharedInstance] playNoVoliceBackgroundTask];
    return YES;
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    [[KPBackgroundTaskUtils sharedInstance] applicationDidEnterBackgroundTask:application];
}
  • 操作app
/// 安装本地
[KPAppTool installAppWithIpaPath:self.ipaPath appIdentfier:nil block:^(NSString *installDesc, NSString *completionDesc) {
    //... 
}];

/// url
[KPAppTool installAppWithRemoteURL:@"your ipa url" downloadProgress:nil completion:nil];

/// 卸载
[KPAppTool uninstallApplication:nil options:nil];

/// 打开
[KPAppTool openApplicationWithBundleID:nil];
  • IPC通知
/// 服务端:ping
[KPAppToolInstance pingTimeSecond:3];
[KPAppToolInstance registerIPCNotfication:@"kp.test.pong" callBack:^(NSString *name) {
    //....
}];
/// 客户端
[KPAppToolInstance recevicePingCallBack:^(NSString *name) {
    NSLog(@"接收到了ping: %@", name);
    [KPAppToolInstance postIPCNoftication:@"kp.test.pong"];
}];
  • 进程间收发消息
 [KPLocalConnect registerLisenerAtPort:5555 callBack:^NSDictionary * _Nonnull(NSString * _Nonnull path, NSDictionary * _Nonnull query) {
     if ([path isEqualToString:@"/xxxpath"]) {
         return @{
             @"path": path?:@"",
             @"quey": query?:@{},
         };
     }
     return @{
         @"msg": @"path is error",
     };
 }];
 
 /// 客户端
 [KPLocalConnect getAtPort:5555 path:@"xxxpath" parameters:@{@"key1": @"value"} completion:^(NSDictionary * _Nonnull response, NSError * _Nonnull error, NSURLSessionDataTask * _Nonnull task) {
     NSLog(@"response: %@", response);;
 }];

About

静默安装,卸载,打开APP,进程通信,后台保护

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages