我想通过我的android apk关闭我的android手机。为此,我编写代码,然后将apk安装在我的android手机上。然后尝试了该应用程序,没有任何反应
代码:
string apiUrl = "https://api.host/csv-upload/api-key?remove-hosts=false;
HttpClient client = new HttpClient();
//Prepare request header
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
client.DefaultRequestHeaders.Add("Api-Key", "xxxyyyzzz");
//cache
CacheControlHeaderValue cacheControl = new CacheControlHeaderValue();
cacheControl.NoCache = true;
client.DefaultRequestHeaders.CacheControl = cacheControl;
byte[] bytes = File.ReadAllBytes(csvFilePath); //c://Temp/test.csv
HttpContent fileContent = new ByteArrayContent(bytes);
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/csv");
try
{
var response = await httpClient.PostAsync(apiUrl , new MultipartFormDataContent
{
{fileContent, "\"file\"", "\"test.csv\""}
});
}
catch(Exception ex)
{
string message = ex.Message;
Console.WriteLine(message); ;
}
finally
{
Console.WriteLine("Error");
}`
仅显示短信 任何帮助,请
答案 0 :(得分:0)
您不能通过普通的SDK应用程序执行此操作。只有使用系统固件签名密钥签名的应用程序才能执行此操作。