我试图使用xamarin.auth登录facebook,但每个教程都使用 startactivity(auth.getui(本));
但是startactivity对我不起作用,我无法运行它
Xamarin Android Xamarin.Auth - Twitter
他使用它但是当我尝试他的代码时,visual studio给它一个红色下划线:
http://i.stack.imgur.com/Svk2M.png
我无所谓我把它放在哪里,它不起作用,请帮忙。
答案 0 :(得分:0)
这取决于参数,但您可以使用:
public static function getVideos($params) {
$key = $params->get('apiKey');
$list = $params->get('playlistID');
$maxVideos = $params->get('maxVideos');
if($key && $list){
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/json','Accept: application/json'));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$apiPlaylist = get_data("https://www.googleapis.com/youtube/v3/playlistItems?part=id,snippet,contentDetails,status&maxResults=".$maxVideos."&playlistId=".$list."&key=".$key."");
$video = json_decode($apiPlaylist);
$videolist = array();
//To display embed code, title and description
foreach ($video->items as $videoitem) {
$videolist[] = $videoitem;
}
return $videolist;
}
return false;
}
public static function getStats($params) {
$key = $params->get('apiKey');
$list = $params->get('playlistID');
$maxVideos = $params->get('maxVideos');
if($key && $list){
function get_data2($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/json','Accept: application/json'));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$apiPlaylist = get_data2("https://www.googleapis.com/youtube/v3/playlistItems?part=id,snippet,contentDetails,status&maxResults=".$maxVideos."&playlistId=".$list."&key=".$key."");
$video2 = json_decode($apiPlaylist);
$videoids = '';
//To get all videoId from playlist
foreach ($video2->items as $statsitem) {
$videoids .= $statsitem->contentDetails->videoId. ",";
}
$apiVideostats = get_data2("https://www.googleapis.com/youtube/v3/videos?part=id,statistics&id=".$videoids."&key=".$key."");
$stats = json_decode($apiVideostats);
$statslist = array();
//To display video statistics viewCount
foreach ($stats->items as $statitem) {
$statslist[] = $statitem;
}
return $statslist;
}
return false;
}