質問編集履歴

1

内容の追加

2017/06/30 02:50

投稿

w00r0ntea
w00r0ntea

スコア18

test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,89 @@
17
17
  特定のアプリのストアページに遷移させたい場合に、どういった方法があるでしょうか?
18
18
 
19
19
  知見をお聞かせ願いたいと思います。
20
+
21
+
22
+
23
+ iOS
24
+
25
+
26
+
27
+ override func viewDidAppear(_ animated: Bool) {
28
+
29
+ let url = URL(string:"itms-apps://itunes.apple.com/app/×××××××××")
30
+
31
+ let alertController = UIAlertController(title: "", message: "\"App Store\"を開きますか?", preferredStyle: .alert)
32
+
33
+ let cancelAction = UIAlertAction(title: "キャンセル", style: .cancel) {
34
+
35
+ action in
36
+
37
+ }
38
+
39
+ let okAction = UIAlertAction(title: "開く", style: .default) {
40
+
41
+ action in if #available(iOS 10.0, *) {
42
+
43
+ UIApplication.shared.open(url!, options: [:], completionHandler:nil)
44
+
45
+ }
46
+
47
+ else {
48
+
49
+ UIApplication.shared.openURL(url!)
50
+
51
+ }
52
+
53
+ }
54
+
55
+ alertController.addAction(cancelAction)
56
+
57
+ alertController.addAction(okAction)
58
+
59
+ present(alertController, animated: true, completion: nil)
60
+
61
+ }
62
+
63
+
64
+
65
+
66
+
67
+ Android
68
+
69
+
70
+
71
+ protected void onCreate(Bundle savedInstanceState) {
72
+
73
+ super.onCreate(savedInstanceState);
74
+
75
+ setContentView(R.layout.activity_main);
76
+
77
+ varWebView = (WebView) findViewById(R.id.webView);
78
+
79
+ varWebView.setWebViewClient(new WebViewClient());
80
+
81
+ new AlertDialog.Builder(MainActivity.this)
82
+
83
+ .setMessage("このページで\"storeを開きますか?\"")
84
+
85
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
86
+
87
+ @Override
88
+
89
+ public void onClick(DialogInterface dialog, int which) {
90
+
91
+ varWebView.loadUrl("https://play.google.com/store/apps/details?id=com.google.android.apps.maps");
92
+
93
+ }
94
+
95
+ })
96
+
97
+ .setNegativeButton("Cancel", null)
98
+
99
+ .show();
100
+
101
+
102
+
103
+ すいません、回答に不備がありました。
104
+
105
+ iOSの×部分はAppidが入ってます。