|  |  |  | 
|---|
|  |  |  | import android.content.ActivityNotFoundException; | 
|---|
|  |  |  | import android.content.Intent; | 
|---|
|  |  |  | import android.net.Uri; | 
|---|
|  |  |  | import android.text.TextUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.secondworld.sdk.GameActivityProxy; | 
|---|
|  |  |  | import com.secondworld.sdk.GameAppProxy; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (json.has("url")) | 
|---|
|  |  |  | url = json.getString("url"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String marketPkg=""; | 
|---|
|  |  |  | if(json.has("marketPkg")) | 
|---|
|  |  |  | marketPkg=json.getString("marketPkg"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Uri uri = Uri.parse("market://details?id=" + GameAppProxy.app.getPackageName()); | 
|---|
|  |  |  | Intent intent = new Intent(Intent.ACTION_VIEW, uri); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | | 
|---|
|  |  |  | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!TextUtils.isEmpty(marketPkg)) { | 
|---|
|  |  |  | intent.setPackage(marketPkg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (GameActivityProxy.I.activity == null) | 
|---|
|  |  |  | return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | GameActivityProxy.I.activity.startActivity(intent); | 
|---|
|  |  |  | } catch (ActivityNotFoundException e) { | 
|---|
|  |  |  | if (url != null && !url.isEmpty()) | 
|---|
|  |  |  | if (!TextUtils.isEmpty(url)) | 
|---|
|  |  |  | GameActivityProxy.I.activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|