0

こんにちは、私の Blackberry Java アプリに広告を表示するためにミレニアル メディアから GET リクエストを作成しようとしていますが、うまくいかないようです。これは私が持っているものです

HttpConnection conn = null;             
InputStream in = null;             
StringBuffer buff = new StringBuffer();             
String result = ""; 

String url ="http://ads.mydas.mobi/getAdapid=157899&auid=ddd25abbb993f79454b12827c803fbafab2ad89b&ua";                          try {                 
conn = (HttpConnection) new ConnectionFactory().getConnection(url).getConnection(); conn.setRequestMethod(HttpConnection.GET);                 
conn.setRequestProperty("User-Agent",              
"Profile/MIDP-1.0 Confirguration/CLDC-1.0");                 
if (conn.getResponseCode() == HttpConnection.HTTP_OK) {                     
in = conn.openInputStream();                     
// parser.parse(in, handler);                  
buff.append(IOUtilities.streamToBytes(in));                     
result = buff.toString();                 
} else {                     
result = "Error in connection" + conn.getResponseCode();
((SettingWaitScreen)screen).update(result);              
} catch (Exception ex) {                 
ex.printStackTrace();             
} finally {                 
try {                     
if (in != null) {                         
in.close();                     
}                     
conn.close();                 
} catch (IOException e) {                     
e.printStackTrace();                 
}             
}

これが正しい方法かどうかはわかりませんが、この広告リクエストを行う際の助けをいただければ幸いです。これは、http://docs.millennialmedia.com/S2S/ad-request.htmlの Web サイトから得たものです。

4

1 に答える 1

0

間違ったベース URL を使用しています。

以下の URL で確認して ください。

上記の URL はブラウザでも機能します。

于 2014-05-14T11:21:03.157 に答える