如何以编程方式连接到Wi-Fi网络? 我也想要确认消息。用于沟通或非接触的过程
代码不起作用
coneectwifi.Click += delegate
{
WifiManager wifi = (WifiManager)GetSystemService(Context.WifiService);
string ssd = "name";
string key = "pass";
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.Ssid = String.Format("\"%s\"", ssd);
wifiConfig.PreSharedKey = String.Format("\"%s\"", key);
WifiManager wifiManager = (WifiManager)GetSystemService(Context.WifiService);
//remember id
int netId = wifiManager.AddNetwork(wifiConfig);
wifiManager.Disconnect();
wifiManager.EnableNetwork(netId, true);
wifiManager.Reconnect();
};
答案 0 :(得分:1)
对于低于Android 9的代码,此代码有效:
function myFunctionNew() {
var labels = Gmail.Users.Labels.list("me").labels;
for (var a = 0; a < labels.length; a++) {
if(labels[a].name == "Customer"){
var labelId = labels[a].id;
break;
}
}
var threads = GmailApp.search('in:Inbox subject:"xxxxxxxxxxxxxx" ');
for (var i = 0; i < threads.length; i++) {
var mid = threads[i].getId();
//retrieve the thread with Gmail API to obtain the ids of the thread messages correctly
var thread = Gmail.Users.Threads.get("me", mid);
// retrieve all messages and their id for each thread
var messages = thread.messages;
for (var j = 0; j < messages.length; j++) {
var message = messages[j];
//retrieve the message id
var messageId = message.id;
//perform the desired actions with the message id
GmailApp.getMessageById(messageId).markRead();
GmailApp.getMessageById(messageId).star();
//now, you need to chose which messages you want to label, for example selectt by snippet:
var snippet = message.snippet;
if (snippet == "Paste here the snippet"){
var myId = messageId;
//only the messages with the specified snippet will be labelled and forwarded instead of the whole thread:
Gmail.Users.Messages.modify({"addLabelIds": [labelId]}, "me", myId);
GmailApp.getMessageById(myId).forward("xxxxxxxxxx@yyyyyy.com");
}
}
}
}
如果您想在android 9或10中连接到wifi,请在此处ping。