Implement opening external package link.
This commit is contained in:
17
Assets/Cryville/Common/Unity/UrlOpener.java
Normal file
17
Assets/Cryville/Common/Unity/UrlOpener.java
Normal 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)));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user