質問編集履歴

7

情報追加

2017/06/16 09:31

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -321,3 +321,25 @@
321
321
  end
322
322
 
323
323
  ```
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+ ```
332
+
333
+ System.out.println("request");
334
+
335
+ Request request = new Request.Builder()
336
+
337
+ .url("http://candii.tk/api/v1/images/search") // HTTPアクセス POST送信 テスト確認用ページ
338
+
339
+ .post(requestBody)
340
+
341
+ .build();
342
+
343
+ System.out.println("request");
344
+
345
+ ```

6

情報追加

2017/06/16 09:31

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -275,3 +275,49 @@
275
275
  06-16 13:55:25.727 346-346/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
276
276
 
277
277
  ```
278
+
279
+
280
+
281
+ API
282
+
283
+ ```Ruby
284
+
285
+ module Api
286
+
287
+ module V1
288
+
289
+ class ImagesController < ApplicationController
290
+
291
+ skip_before_filter :verify_authenticity_token
292
+
293
+
294
+
295
+ def index
296
+
297
+ @images = Image.all
298
+
299
+ render json: @images
300
+
301
+ end
302
+
303
+
304
+
305
+ def search
306
+
307
+ @images = Image.all
308
+
309
+ @images.destroy_all
310
+
311
+ render json: @images
312
+
313
+ end
314
+
315
+
316
+
317
+ end
318
+
319
+ end
320
+
321
+ end
322
+
323
+ ```

5

情報追加

2017/06/16 08:07

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -216,7 +216,7 @@
216
216
 
217
217
 
218
218
 
219
- ```
219
+ ```Java
220
220
 
221
221
  RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
222
222
 
@@ -224,7 +224,7 @@
224
224
 
225
225
 
226
226
 
227
- ```
227
+ ```Ruby
228
228
 
229
229
  def search
230
230
 
@@ -239,3 +239,39 @@
239
239
  end
240
240
 
241
241
  ```
242
+
243
+
244
+
245
+ ログ
246
+
247
+ ```
248
+
249
+ 06-16 13:55:23.119 346-346/? I/art: Not late-enabling -Xcheck:jni (already on)
250
+
251
+ 06-16 13:55:23.119 346-346/? W/art: Unexpected CPU variant for X86 using defaults: x86
252
+
253
+ 06-16 13:55:23.386 346-346/station.around.aroundsatation W/System: ClassLoader referenced unknown path: /data/app/station.around.aroundsatation-2/lib/x86
254
+
255
+ 06-16 13:55:23.411 346-346/station.around.aroundsatation I/InstantRun: starting instant run server: is main process
256
+
257
+ 06-16 13:55:23.909 346-346/station.around.aroundsatation W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
258
+
259
+ 06-16 13:55:24.219 346-353/station.around.aroundsatation W/art: Suspending all threads took: 17.584ms
260
+
261
+ 06-16 13:55:24.293 346-346/station.around.aroundsatation D/debug: locationStart()
262
+
263
+ 06-16 13:55:24.294 346-346/station.around.aroundsatation D/debug: gpsEnabled
264
+
265
+ 06-16 13:55:24.499 346-391/station.around.aroundsatation I/OpenGLRenderer: Initialized EGL, version 1.4
266
+
267
+ 06-16 13:55:24.499 346-391/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 1
268
+
269
+ 06-16 13:55:24.500 346-391/station.around.aroundsatation W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
270
+
271
+ 06-16 13:55:24.500 346-391/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 0
272
+
273
+ 06-16 13:55:24.559 346-346/station.around.aroundsatation W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
274
+
275
+ 06-16 13:55:25.727 346-346/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
276
+
277
+ ```

4

情報追加

2017/06/16 04:58

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -221,3 +221,21 @@
221
221
  RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
222
222
 
223
223
  ```
224
+
225
+
226
+
227
+ ```
228
+
229
+ def search
230
+
231
+ json_request = JSON.parse(request.body.read)
232
+
233
+ @images = Image.where(location: json_request.gps)★変更★
234
+
235
+ @images.destroy_all
236
+
237
+ render json: @images
238
+
239
+ end
240
+
241
+ ```

3

上記

2017/06/16 04:57

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -205,3 +205,19 @@
205
205
 
206
206
 
207
207
  ご経験ある方、ご助言お願いします。
208
+
209
+
210
+
211
+
212
+
213
+ ### 追加
214
+
215
+
216
+
217
+
218
+
219
+ ```
220
+
221
+ RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
222
+
223
+ ```

2

情報修正

2017/06/16 04:56

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -42,30 +42,22 @@
42
42
 
43
43
  MediaType MIMEType= MediaType.parse("application/json; charset=utf-8");
44
44
 
45
+ RequestBody body = RequestBody.create(MIMEType, "地下一階");
46
+
47
+
48
+
49
+
50
+
45
- RequestBody formBody = new FormBody.Builder()
51
+ Request request = new Request.Builder()
46
-
52
+
47
- .add("gps", "地下一階")
53
+ .url("https://town-sagae.c9users.io/api/v1/images/search")
54
+
55
+ .post(body)
48
56
 
49
57
  .build();
50
58
 
51
59
 
52
60
 
53
- RequestBody body = RequestBody.create(MIMEType, "地下一階");
54
-
55
-
56
-
57
-
58
-
59
- Request request = new Request.Builder()
60
-
61
- .url("https://town-sagae.c9users.io/api/v1/images/search")
62
-
63
- .post(body)
64
-
65
- .build();
66
-
67
-
68
-
69
61
  OkHttpClient client = new OkHttpClient();
70
62
 
71
63
  client.newCall(request).enqueue(new Callback() {

1

情報追加

2017/06/16 03:43

投稿

s.k
s.k

スコア423

test CHANGED
File without changes
test CHANGED
@@ -166,6 +166,46 @@
166
166
 
167
167
 
168
168
 
169
+ エラーは出ていないと思うのですが、ログはこのようになっています。
170
+
171
+ Java側です。
172
+
173
+
174
+
175
+ ```
176
+
177
+ 06-16 12:12:54.135 9456-9456/? I/art: Not late-enabling -Xcheck:jni (already on)
178
+
179
+ 06-16 12:12:54.135 9456-9456/? W/art: Unexpected CPU variant for X86 using defaults: x86
180
+
181
+ 06-16 12:12:54.564 9456-9456/station.around.aroundsatation W/System: ClassLoader referenced unknown path: /data/app/station.around.aroundsatation-1/lib/x86
182
+
183
+ 06-16 12:12:54.574 9456-9456/station.around.aroundsatation I/InstantRun: starting instant run server: is main process
184
+
185
+ 06-16 12:12:54.990 9456-9463/station.around.aroundsatation W/art: Suspending all threads took: 14.908ms
186
+
187
+ 06-16 12:12:55.113 9456-9456/station.around.aroundsatation W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
188
+
189
+ 06-16 12:12:55.465 9456-9456/station.around.aroundsatation D/debug: locationStart()
190
+
191
+ 06-16 12:12:55.467 9456-9456/station.around.aroundsatation D/debug: gpsEnabled
192
+
193
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation I/OpenGLRenderer: Initialized EGL, version 1.4
194
+
195
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 1
196
+
197
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
198
+
199
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 0
200
+
201
+ 06-16 12:12:55.702 9456-9456/station.around.aroundsatation W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
202
+
203
+ 06-16 12:12:56.907 9456-9456/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
204
+
205
+ ```
206
+
207
+
208
+
169
209
 
170
210
 
171
211