質問編集履歴
3
デバッグモードでの挙動を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
android studioを使用しています。
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
Google play developer consoleにおいて、アイテム課金の値段を税引きで200円と設定したのに、アプリ上では税引きで100円と表示されていて困っています。
|
2
6
|
|
3
7
|
|
@@ -220,4 +224,6 @@
|
|
220
224
|
|
221
225
|
|
222
226
|
|
227
|
+
なお、JSONObject object = new JSONObject(row);箇所でブレークポイントを張り、デバッグモードでこの場所で止めて、item3の値段を確認したことろ、設定されていない100円でした。
|
228
|
+
|
223
229
|
よろしくお願い申し上げます。
|
2
正常に動作している箇所を明記
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。
|
13
|
+
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。これ以外は正常に表示されます。
|
14
14
|
|
15
15
|
new AsyncAppTask().execute();を実行すると、サブスレッドが立ち上がり、下記コードが実行します。
|
16
16
|
|
1
アイテム情報を取得し表示させるコードを追加しました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
developer consoleで設定したアイテムの価格
|
1
|
+
developer consoleで設定したアイテムの価格が、アプリ上の表示と異なる理由
|
test
CHANGED
@@ -5,3 +5,219 @@
|
|
5
5
|
価格の表示はhttp://y-anz-m.blogspot.jp/2013/02/android-api-version3.htmlを参考にしており、変数名の間違いなどはないのですが、インテントで表示させたダイアログも間違っています。
|
6
6
|
|
7
7
|
なぜ設定と異なるのでしょうか。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
現状の、アイテム情報を取得し表示させるコードは以下の通りです。アイテムidは、item1,item2,item3の3種類で、それぞれ、100円、130円、200円としてdeveloper consoleに登録しましたが、200円のアイテムが100円と表示されています。
|
14
|
+
|
15
|
+
new AsyncAppTask().execute();を実行すると、サブスレッドが立ち上がり、下記コードが実行します。
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```ここに言語を入力
|
22
|
+
|
23
|
+
class AsyncAppTask extends AsyncTask<Void, Void, String>
|
24
|
+
|
25
|
+
{
|
26
|
+
|
27
|
+
private String[] BuyPrice=new String[3];
|
28
|
+
|
29
|
+
private String[] BuyDes=new String[3];
|
30
|
+
|
31
|
+
private String[] BuyTitle=new String[3];
|
32
|
+
|
33
|
+
@Override
|
34
|
+
|
35
|
+
protected void onPreExecute() {
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
@Override
|
40
|
+
|
41
|
+
protected String doInBackground(Void... arg0) {
|
42
|
+
|
43
|
+
// バックグランド処理をここに記述します
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
ArrayList<String> request_id_list = new ArrayList<String>();
|
48
|
+
|
49
|
+
request_id_list.add("item1");
|
50
|
+
|
51
|
+
request_id_list.add("item2");
|
52
|
+
|
53
|
+
request_id_list.add("item3");
|
54
|
+
|
55
|
+
Bundle query = new Bundle();
|
56
|
+
|
57
|
+
query.putStringArrayList("ITEM_ID_LIST", request_id_list);
|
58
|
+
|
59
|
+
// リクエストに対するレスポンスを取得する
|
60
|
+
|
61
|
+
try {
|
62
|
+
|
63
|
+
Bundle details = billingService.getSkuDetails(3, getPackageName(), "inapp", query);
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
// レスポンスコードを取得する
|
68
|
+
|
69
|
+
int responseCode = details.getInt("RESPONSE_CODE");
|
70
|
+
|
71
|
+
// 成功
|
72
|
+
|
73
|
+
if (responseCode == 0) {
|
74
|
+
|
75
|
+
// 商品リストを取得する
|
76
|
+
|
77
|
+
ArrayList<String> response_list = details.getStringArrayList("DETAILS_LIST");
|
78
|
+
|
79
|
+
int num;
|
80
|
+
|
81
|
+
for (String row : response_list) {
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
try {
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
// JSONオブジェクトへ変換する
|
90
|
+
|
91
|
+
JSONObject object = new JSONObject(row);
|
92
|
+
|
93
|
+
// 商品情報をログに出力する
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
String pid=object.getString("productId");
|
98
|
+
|
99
|
+
num=pid.charAt(pid.length()-1)-'0'-1;
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
BuyPrice[num]=object.getString("price");
|
104
|
+
|
105
|
+
BuyDes[num]= object.getString("description");
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
BuyTitle[num]=object.getString("title");
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
} catch (JSONException e) {
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
} catch (RemoteException e) {
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
return "Thread Samples";
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
@Override
|
138
|
+
|
139
|
+
protected void onPostExecute(String result) {
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
TextView item1title=(TextView)findViewById(R.id.textItem1Title);
|
144
|
+
|
145
|
+
item1title.setText(BuyTitle[0]);
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
TextView item2title=(TextView)findViewById(R.id.textItem2Title);
|
150
|
+
|
151
|
+
item2title.setText(BuyTitle[1]);
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
TextView item3title=(TextView)findViewById(R.id.textItem3Title);
|
156
|
+
|
157
|
+
item3title.setText(BuyTitle[2]);
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
TextView item1price=(TextView)findViewById(R.id.textItem1Price);
|
162
|
+
|
163
|
+
item1price.setText("税抜き"+BuyPrice[0]);
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
TextView item2price=(TextView)findViewById(R.id.textItem2Price);
|
168
|
+
|
169
|
+
item2price.setText("税抜き"+BuyPrice[1]);
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
TextView item3price=(TextView)findViewById(R.id.textItem3Price);
|
174
|
+
|
175
|
+
item3price.setText("税抜き"+BuyPrice[2]);
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
TextView item1desc=(TextView)findViewById(R.id.textItem1);
|
180
|
+
|
181
|
+
item1desc.setText(BuyDes[0]);
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
TextView item2desc=(TextView)findViewById(R.id.textItem2);
|
186
|
+
|
187
|
+
item2desc.setText(BuyDes[1]);
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
TextView item3desc=(TextView)findViewById(R.id.textItem3);
|
192
|
+
|
193
|
+
item3desc.setText(BuyDes[2]);
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
Button buttonItem1Buy=(Button)findViewById(R.id.ButtonBuyItem1);
|
198
|
+
|
199
|
+
buttonItem1Buy.setText(BuyTitle[0]+"を購入");
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
Button buttonItem2Buy=(Button)findViewById(R.id.ButtonBuyItem2);
|
204
|
+
|
205
|
+
buttonItem2Buy.setText(BuyTitle[1]+"を購入");
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
Button buttonItem3Buy=(Button)findViewById(R.id.ButtonBuyItem3);
|
210
|
+
|
211
|
+
buttonItem3Buy.setText(BuyTitle[2]+"を購入");
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
```
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
よろしくお願い申し上げます。
|