I am working on a Windows 8.1 UWP app.
I am facing differences when I had put breakpoints while debugging the app for Windows Phone 8.1 which I am debugging on my Windows Phone 10 device.
Below is code which I am calling from a page in windows phone using a button click :
Can someone please explain what is it that I am missing here.
What I have tried:
private void Button_Click(object sender, RoutedEventArgs e)
{
AuthenticateUser();
}
private async void AuthenticateUser()
{
App.service = await App.authHelper.AuthenticateAsync();
if (App.service != null)
{
string folderID = DriveHelper.GetRootFolderId(App.service);
if (App.service != null)
this.Frame.Navigate(typeof(DriveHome), folderID);
}
else
{
}
}
public class AuthenticationHelper
{
private UserCredential credential;
private DriveService service;
public async Task<DriveService> AuthenticateAsync()
{
if (service != null)
return service;
try
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new Uri("ms-appx:///Assets/client_secrets.json"),
new[] { DriveService.Scope.Drive,
DriveService.Scope.DriveFile,
DriveService.Scope.DriveAppdata,
DriveService.Scope.DriveMetadata },
"user",
CancellationToken.None);
var initializer = new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Google Drive Client",
};
service = new DriveService(initializer);
}
catch(Exception ex)
{
}
return service;
}
}