質問編集履歴
3
デバッグモードでの挙動を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
android studioを使用しています。
|
2
|
+
|
1
3
|
Google play developer consoleにおいて、アイテム課金の値段を税引きで200円と設定したのに、アプリ上では税引きで100円と表示されていて困っています。
|
2
4
|
|
3
5
|
価格の表示はhttp://y-anz-m.blogspot.jp/2013/02/android-api-version3.htmlを参考にしており、変数名の間違いなどはないのですが、インテントで表示させたダイアログも間違っています。
|
@@ -109,4 +111,5 @@
|
|
109
111
|
|
110
112
|
```
|
111
113
|
|
114
|
+
なお、JSONObject object = new JSONObject(row);箇所でブレークポイントを張り、デバッグモードでこの場所で止めて、item3の値段を確認したことろ、設定されていない100円でした。
|
112
115
|
よろしくお願い申し上げます。
|
2
正常に動作している箇所を明記
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
なぜ設定と異なるのでしょうか。
|
5
5
|
|
6
6
|
|
7
|
-
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。
|
7
|
+
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。これ以外は正常に表示されます。
|
8
8
|
new AsyncAppTask().execute();を実行すると、サブスレッドが立ち上がり、下記コードが実行します。
|
9
9
|
|
10
10
|
|
1
アイテム情報を取得し表示させるコードを追加しました。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
developer consoleで設定したアイテムの価格
|
1
|
+
developer consoleで設定したアイテムの価格が、アプリ上の表示と異なる理由
|
body
CHANGED
@@ -1,4 +1,112 @@
|
|
1
1
|
Google play developer consoleにおいて、アイテム課金の値段を税引きで200円と設定したのに、アプリ上では税引きで100円と表示されていて困っています。
|
2
2
|
|
3
3
|
価格の表示はhttp://y-anz-m.blogspot.jp/2013/02/android-api-version3.htmlを参考にしており、変数名の間違いなどはないのですが、インテントで表示させたダイアログも間違っています。
|
4
|
-
なぜ設定と異なるのでしょうか。
|
4
|
+
なぜ設定と異なるのでしょうか。
|
5
|
+
|
6
|
+
|
7
|
+
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。
|
8
|
+
new AsyncAppTask().execute();を実行すると、サブスレッドが立ち上がり、下記コードが実行します。
|
9
|
+
|
10
|
+
|
11
|
+
```ここに言語を入力
|
12
|
+
class AsyncAppTask extends AsyncTask<Void, Void, String>
|
13
|
+
{
|
14
|
+
private String[] BuyPrice=new String[3];
|
15
|
+
private String[] BuyDes=new String[3];
|
16
|
+
private String[] BuyTitle=new String[3];
|
17
|
+
@Override
|
18
|
+
protected void onPreExecute() {
|
19
|
+
}
|
20
|
+
@Override
|
21
|
+
protected String doInBackground(Void... arg0) {
|
22
|
+
// バックグランド処理をここに記述します
|
23
|
+
|
24
|
+
ArrayList<String> request_id_list = new ArrayList<String>();
|
25
|
+
request_id_list.add("item1");
|
26
|
+
request_id_list.add("item2");
|
27
|
+
request_id_list.add("item3");
|
28
|
+
Bundle query = new Bundle();
|
29
|
+
query.putStringArrayList("ITEM_ID_LIST", request_id_list);
|
30
|
+
// リクエストに対するレスポンスを取得する
|
31
|
+
try {
|
32
|
+
Bundle details = billingService.getSkuDetails(3, getPackageName(), "inapp", query);
|
33
|
+
|
34
|
+
// レスポンスコードを取得する
|
35
|
+
int responseCode = details.getInt("RESPONSE_CODE");
|
36
|
+
// 成功
|
37
|
+
if (responseCode == 0) {
|
38
|
+
// 商品リストを取得する
|
39
|
+
ArrayList<String> response_list = details.getStringArrayList("DETAILS_LIST");
|
40
|
+
int num;
|
41
|
+
for (String row : response_list) {
|
42
|
+
|
43
|
+
try {
|
44
|
+
|
45
|
+
// JSONオブジェクトへ変換する
|
46
|
+
JSONObject object = new JSONObject(row);
|
47
|
+
// 商品情報をログに出力する
|
48
|
+
|
49
|
+
String pid=object.getString("productId");
|
50
|
+
num=pid.charAt(pid.length()-1)-'0'-1;
|
51
|
+
|
52
|
+
BuyPrice[num]=object.getString("price");
|
53
|
+
BuyDes[num]= object.getString("description");
|
54
|
+
|
55
|
+
BuyTitle[num]=object.getString("title");
|
56
|
+
|
57
|
+
|
58
|
+
} catch (JSONException e) {
|
59
|
+
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
}
|
64
|
+
} catch (RemoteException e) {
|
65
|
+
|
66
|
+
}
|
67
|
+
return "Thread Samples";
|
68
|
+
}
|
69
|
+
@Override
|
70
|
+
protected void onPostExecute(String result) {
|
71
|
+
|
72
|
+
TextView item1title=(TextView)findViewById(R.id.textItem1Title);
|
73
|
+
item1title.setText(BuyTitle[0]);
|
74
|
+
|
75
|
+
TextView item2title=(TextView)findViewById(R.id.textItem2Title);
|
76
|
+
item2title.setText(BuyTitle[1]);
|
77
|
+
|
78
|
+
TextView item3title=(TextView)findViewById(R.id.textItem3Title);
|
79
|
+
item3title.setText(BuyTitle[2]);
|
80
|
+
|
81
|
+
TextView item1price=(TextView)findViewById(R.id.textItem1Price);
|
82
|
+
item1price.setText("税抜き"+BuyPrice[0]);
|
83
|
+
|
84
|
+
TextView item2price=(TextView)findViewById(R.id.textItem2Price);
|
85
|
+
item2price.setText("税抜き"+BuyPrice[1]);
|
86
|
+
|
87
|
+
TextView item3price=(TextView)findViewById(R.id.textItem3Price);
|
88
|
+
item3price.setText("税抜き"+BuyPrice[2]);
|
89
|
+
|
90
|
+
TextView item1desc=(TextView)findViewById(R.id.textItem1);
|
91
|
+
item1desc.setText(BuyDes[0]);
|
92
|
+
|
93
|
+
TextView item2desc=(TextView)findViewById(R.id.textItem2);
|
94
|
+
item2desc.setText(BuyDes[1]);
|
95
|
+
|
96
|
+
TextView item3desc=(TextView)findViewById(R.id.textItem3);
|
97
|
+
item3desc.setText(BuyDes[2]);
|
98
|
+
|
99
|
+
Button buttonItem1Buy=(Button)findViewById(R.id.ButtonBuyItem1);
|
100
|
+
buttonItem1Buy.setText(BuyTitle[0]+"を購入");
|
101
|
+
|
102
|
+
Button buttonItem2Buy=(Button)findViewById(R.id.ButtonBuyItem2);
|
103
|
+
buttonItem2Buy.setText(BuyTitle[1]+"を購入");
|
104
|
+
|
105
|
+
Button buttonItem3Buy=(Button)findViewById(R.id.ButtonBuyItem3);
|
106
|
+
buttonItem3Buy.setText(BuyTitle[2]+"を購入");
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
```
|
111
|
+
|
112
|
+
よろしくお願い申し上げます。
|