@@ -36,6 +36,20 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
3636 let platformData = this . $platformsData . getPlatformData ( platform . toLowerCase ( ) ) ;
3737 let projectFilesPath = path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ;
3838
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+
3953 let restartAppOnDeviceAction = ( device : Mobile . IDevice , deviceAppData : Mobile . IDeviceAppData , localToDevicePaths ?: Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > => {
4054 let platformSpecificUsbLiveSyncService = this . resolveUsbLiveSyncService ( platform || this . $devicesServices . platform , device ) ;
4155 return platformSpecificUsbLiveSyncService . restartApplication ( deviceAppData , localToDevicePaths ) ;
@@ -54,7 +68,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
5468
5569 let watchGlob = path . join ( this . $projectData . projectDir , constants . APP_FOLDER_NAME ) + "/**/*" ;
5670
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 ( ) ;
5872 } ) . future < void > ( ) ( ) ;
5973 }
6074
0 commit comments