Write a private access file to another app's files directory

前端 未结 4 693
花落未央
花落未央 2020-12-31 19:57

The two apps have the same sharedUserId. When I use this code in app1

context.openFileOutput(\"/data/data/org.me.app2/files/shared-data.dat\", MODE_PRIVATE)
         


        
4条回答
  •  星月不相逢
    2020-12-31 20:38

    Open a FileOutputStream of the needed file, relative to this path:

    String filePath = getPackageManager().
        getPackageInfo("com.your2ndApp.package", 0).
        applicationInfo.dataDir;
    

提交回复
热议问题