CanPHP框架技术讨论

导航

 

代码如下:

 public static void LauchInstall(String FilePathName, Context context)
        {
                chmod("777", FilePathName);
                Intent intent = new Intent(Intent.ACTION_VIEW);  
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setDataAndType(Uri.fromFile(new File(FilePathName)), "application/vnd.android.package-archive");  
                context.startActivity(intent);                   
        }
        
        //修改apk权限
        public static void chmod(String permission, String path)
        {
                try
                        {
                                String command         = "chmod " + permission + " " + path;
                                Runtime runtime = Runtime.getRuntime();
                                runtime.exec(command);
                        }
                        catch (IOException e)
                        {
                                e.printStackTrace();
                        }
        }

参考地址:http://www.devdiv.com/thread-72452-1-1.html

posted on 2012-11-07 16:27  創丗仼  阅读(1104)  评论(0编辑  收藏  举报