@@ -36,6 +36,20 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
36
36
let platformData = this . $platformsData . getPlatformData ( platform . toLowerCase ( ) ) ;
37
37
let projectFilesPath = path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ;
38
38
39
+ let canLiveSyncAction = ( device : Mobile . IDevice , appIdentifier : string ) : IFuture < boolean > => {
40
+ return ( ( ) => {
41
+ if ( platform . toLowerCase ( ) === "android" ) {
42
+ let output = ( < Mobile . IAndroidDevice > device ) . adb . executeShellCommand ( `"echo '' | run-as ${ appIdentifier } "` ) . wait ( ) ;
43
+ if ( output . indexOf ( `run-as: Package '${ appIdentifier } ' is unknown` ) !== - 1 ) {
44
+ this . $logger . warn ( `Unable to livesync on device ${ device . deviceInfo . identifier } . Consider upgrading your device OS.` ) ;
45
+ return false ;
46
+ }
47
+ }
48
+
49
+ return true ;
50
+ } ) . future < boolean > ( ) ( ) ;
51
+ }
52
+
39
53
let restartAppOnDeviceAction = ( device : Mobile . IDevice , deviceAppData : Mobile . IDeviceAppData , localToDevicePaths ?: Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > => {
40
54
let platformSpecificUsbLiveSyncService = this . resolveUsbLiveSyncService ( platform || this . $devicesServices . platform , device ) ;
41
55
return platformSpecificUsbLiveSyncService . restartApplication ( deviceAppData , localToDevicePaths ) ;
@@ -54,7 +68,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
54
68
55
69
let watchGlob = path . join ( this . $projectData . projectDir , constants . APP_FOLDER_NAME ) + "/**/*" ;
56
70
57
- this . sync ( platform , this . $projectData . projectId , platformData . appDestinationDirectoryPath , projectFilesPath , this . excludedProjectDirsAndFiles , watchGlob , restartAppOnDeviceAction , notInstalledAppOnDeviceAction , beforeBatchLiveSyncAction ) . wait ( ) ;
71
+ this . sync ( platform , this . $projectData . projectId , platformData . appDestinationDirectoryPath , projectFilesPath , this . excludedProjectDirsAndFiles , watchGlob , restartAppOnDeviceAction , notInstalledAppOnDeviceAction , beforeBatchLiveSyncAction , canLiveSyncAction ) . wait ( ) ;
58
72
} ) . future < void > ( ) ( ) ;
59
73
}
60
74
0 commit comments