Implement opening external package link.

This commit is contained in:
2023-07-03 01:10:45 +08:00
parent 864ea91be0
commit 83b9c27e94
5 changed files with 77 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
package world.cryville.common.unity;
import android.content.Intent;
import android.net.Uri;
import com.unity3d.player.UnityPlayer;
import com.unity3d.player.UnityPlayerActivity;
public final class UrlOpener {
private UrlOpener() { }
static UnityPlayerActivity activity;
public static void open(String url) {
if (activity == null) activity = (UnityPlayerActivity)UnityPlayer.currentActivity;
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
}