質問するログイン新規登録

質問編集履歴

1

内容の追加

2017/06/30 02:50

投稿

w00r0ntea
w00r0ntea

スコア18

title CHANGED
File without changes
body CHANGED
@@ -7,4 +7,47 @@
7
7
  といった形でアップデートさせたいアプリを呼んでいます。しかし、これだとストアアプリは起動しません。
8
8
 
9
9
  特定のアプリのストアページに遷移させたい場合に、どういった方法があるでしょうか?
10
- 知見をお聞かせ願いたいと思います。
10
+ 知見をお聞かせ願いたいと思います。
11
+
12
+ iOS
13
+
14
+ override func viewDidAppear(_ animated: Bool) {
15
+ let url = URL(string:"itms-apps://itunes.apple.com/app/×××××××××")
16
+ let alertController = UIAlertController(title: "", message: "\"App Store\"を開きますか?", preferredStyle: .alert)
17
+ let cancelAction = UIAlertAction(title: "キャンセル", style: .cancel) {
18
+ action in
19
+ }
20
+ let okAction = UIAlertAction(title: "開く", style: .default) {
21
+ action in if #available(iOS 10.0, *) {
22
+ UIApplication.shared.open(url!, options: [:], completionHandler:nil)
23
+ }
24
+ else {
25
+ UIApplication.shared.openURL(url!)
26
+ }
27
+ }
28
+ alertController.addAction(cancelAction)
29
+ alertController.addAction(okAction)
30
+ present(alertController, animated: true, completion: nil)
31
+ }
32
+
33
+
34
+ Android
35
+
36
+ protected void onCreate(Bundle savedInstanceState) {
37
+ super.onCreate(savedInstanceState);
38
+ setContentView(R.layout.activity_main);
39
+ varWebView = (WebView) findViewById(R.id.webView);
40
+ varWebView.setWebViewClient(new WebViewClient());
41
+ new AlertDialog.Builder(MainActivity.this)
42
+ .setMessage("このページで\"storeを開きますか?\"")
43
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
44
+ @Override
45
+ public void onClick(DialogInterface dialog, int which) {
46
+ varWebView.loadUrl("https://play.google.com/store/apps/details?id=com.google.android.apps.maps");
47
+ }
48
+ })
49
+ .setNegativeButton("Cancel", null)
50
+ .show();
51
+
52
+ すいません、回答に不備がありました。
53
+ iOSの×部分はAppidが入ってます。