Good day, all! I'm currently coding a plugin for Unity so that the user can access the file browser and pick an app. Upon picking the app, the file path is supposed to be saved. My code works so far, it's able to get the file path of the file but not the full one.
This is my code so far
int PICKFILE_RESULT_CODE = 1;
@Override
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/vnd.android.package-archive");
startActivityForResult(intent, PICKFILE_RESULT_CODE);
}
@SuppressLint("InlinedApi")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode==RESULT_OK && requestCode==PICKFILE_RESULT_CODE && data != null)
{
String apkPath = data.getData().getPath();
UnityPlayer.UnitySendMessage("Browser", "OnApkPick", apkPath);
Browser.this.finish();
super.onActivityResult(requestCode, resultCode, data);
}
}
Thanks in advance.