乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      安卓App自動(dòng)升級(jí)

       npkaida 2019-08-28
      導(dǎo)航:論壇 -> 移動(dòng)應(yīng)用開發(fā) 斑竹:flyers,iamdream 
      作者:
      男 terony (圣光)★☆☆☆☆-
      盒子活躍會(huì)員
      2019/8/17 20:03:43
      標(biāo)題:
      安卓App自動(dòng)升級(jí)瀏覽:318
      加入我的收藏
      樓主:IDE:Delphi 10.3.0
      問題描述:從自有服務(wù)器下載APK安卓包成功,但是無法成功調(diào)用該安裝包進(jìn)行安裝。
      代碼如下:
      var
        Intent: JIntent;
        AFile: string;
      begin
        //PSetup.LAPKFi是已經(jīng)下載到本地(手機(jī))的APK路徑,文件已經(jīng)成功下載
        AFile := 'content://'+PSetup.LAPKFi;
        Intent:=TJIntent.Create;
        Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
        Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
        Intent.setDataAndType(TJnet_Uri.JavaClass.parse(StringToJString(AFile)),
        StringToJString('application/vnd.android.package-archive'));
        try
          TAndroidHelper.Activity.startActivity(Intent);
          ShowMessage('Install Finished.');
        except
          on e: Exception do
          begin
            ShowMessage('Error Message:'+e.Message);
          end;
        end;
      end;

      如果使用AFile := 'file://'+PSetup.LAPKFi;會(huì)遇到exposed beyong app through intent.getdata()錯(cuò)誤提示,換成現(xiàn)在的AFile := 'content://'+PSetup.LAPKFi;,不會(huì)有任何提示,但是也不會(huì)進(jìn)行安裝。
      望不吝賜教。謝謝!
      ----------------------------------------------
      作者:
      男 wj7927 (元素)★☆☆☆☆-
      盒子活躍會(huì)員
      2019/8/19 10:10:24
      1樓:var
        aFile:Jfile;
        Intent:JIntent;
      begin
        aFile:=TJfile.JavaClass.init(StringToJString(TPath.GetSharedDownloadsPath),StringToJString('XXX.apk'));
        Intent := TJIntent.Create ;
        Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
        Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
        Intent.setDataAndType(TJnet_Uri.JavaClass.fromFile(aFile),StringToJString('application/vnd.android.package-archive'));
        SharedActivityContext.startActivity(Intent);
      end;
      ----------------------------------------------
      -
      作者:
      男 terony (圣光)★☆☆☆☆-
      盒子活躍會(huì)員
      2019/8/26 21:04:21
      2樓:非常感謝你的回復(fù)。
      我已經(jīng)試過了,會(huì)出現(xiàn)exposed beyong app through intent.getdata()錯(cuò)誤提示。
      應(yīng)該是個(gè)權(quán)限問題,需要修改xml文件。
      我還在研究中,謝謝你了。
      ----------------------------------------------
      作者:
      男 codecoolie (CodeCoolie)▲▲▲▲△-
      注冊(cè)會(huì)員
      2019/8/26 21:12:56
      3樓:Memu -> Project -> Options -> Application -> Entitilement List -> Secure File Sharing -> Check
      ----------------------------------------------
      FFmpeg for Delphi http://www.CCAVC.com http://www.DelphiFFmpeg.com
      作者:
      男 codecoolie (CodeCoolie)▲▲▲▲△-
      注冊(cè)會(huì)員
      2019/8/26 21:22:23
      4樓:7.0以下用TJnet_Uri.JavaClass.fromFile
      7.0及以上用JFileProvider,Intent需要FLAG_GRANT_READ_URI_PERMISSION

      8.0以下需要ACTION_VIEW
      8.0及以上需要ACTION_INSTALL_PACKAGE

      同時(shí)需要FLAG_ACTIVITY_NEW_TASK

      等我待會(huì)找找我以前寫的代碼
      ----------------------------------------------
      FFmpeg for Delphi http://www.CCAVC.com http://www.DelphiFFmpeg.com
      作者:
      男 codecoolie (CodeCoolie)▲▲▲▲△-
      注冊(cè)會(huì)員
      2019/8/26 23:30:40
      5樓:procedure _InstallApk(Apk: string);
      var
        LFile: JFile;
        LIntent: JIntent;
      begin
        LFile := TJFile.JavaClass.init(StringToJString(ExtractFilePath(Apk)), StringToJstring(ExtractFileName(Apk)));
        LIntent := TJIntent.Create;
        LIntent.setAction(TJIntent.JavaClass.ACTION_VIEW);
        LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
        LIntent.setDataAndType(TJnet_Uri.JavaClass.fromFile(LFile), StringToJString('application/vnd.android.package-archive'));
        TAndroidHelper.Context.startActivity(LIntent);
      end;
      procedure InstallApk(Apk: string);
      var
        LFile: JFile;
        LIntent: JIntent;
        LNet_Uri: Jnet_Uri;
      begin
        if not TOSVersion.Check(7, 0) then
        begin
          _InstallApk(Apk);
          Exit;
        end;
        LFile := TJFile.JavaClass.init(StringToJString(ExtractFilePath(Apk)), StringToJstring(ExtractFileName(Apk)));
        LIntent := TJIntent.Create;
        if TOSVersion.Check(8, 0) then
          LIntent.setAction(TJIntent.JavaClass.ACTION_INSTALL_PACKAGE)
        else
          LIntent.setAction(TJIntent.JavaClass.ACTION_VIEW);
        LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
        if TOSVersion.Check(7, 0) then
        begin
          // fix: android.os.FileUriExposedException: exposed beyond app through Intent.getData()
          // Project -> Options -> Application -> Entitlement List -> Secure File Sharing -> Check it
          LIntent.addFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION);
          LNet_Uri := TJFileProvider.JavaClass.getUriForFile(TAndroidHelper.Context,
            StringToJString(JStringToString(TAndroidHelper.Context.getPackageName) + '.fileprovider'), LFile);
        end
        else
          LNet_Uri := TJnet_Uri.JavaClass.fromFile(LFile);
        LIntent.setDataAndType(LNet_Uri, StringToJString('application/vnd.android.package-archive'));
        TAndroidHelper.Context.startActivity(LIntent);
      end;
      ----------------------------------------------
      FFmpeg for Delphi http://www.CCAVC.com http://www.DelphiFFmpeg.com

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多