Can't singin into SkyDrive account. WP7 - windows-phone-7

I am making SkyDrive integration in my app for Windows phone. Every time after login screen in signInButton_SessionChanged it gives me e.Status = Unknown with e.Error = "".
I tried download some examples for SkyDrive integration
http://rabeb.wordpress.com/2012/01/07/using-skydrive-in-your-windows-phone-applications-part-1/
, but it gives the same result.
private void signInButton1_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
if (e.Status == LiveConnectSessionStatus.Connected)
{
session = e.Session;
client = new LiveConnectClient(session);
infoTextBlock.Text = "Signed in.";
}
else
{
infoTextBlock.Text = "Not signed in.";
client = null;
}
}
I tried to change App ID ond Live account also, but nothing helps. Please help.

This can happen if in application settings at Live Connect Developer Center you haven't specified that it is a Mobile client app:

Related

Detect network changes in Xamarin Forms

I want to detect when the user is online or offline.
I am using CrossConnectivity package to detect connectivity changes.
I have to connect to VPN (Sonic Wall to be exact) in order to connect to my server.
My problem is this: When I am connecting to my server, I need to switch apps in order for me to connect to my server. When I switch back to my app the function SyncFunction.SyncUser(host, database, contact, ipaddress, pingipaddress) is not executing. The connectivity changed function is not on my App.xaml.cs it is on my Main Menu Content page because I need the sync function to be executed in my main menu not the whole app. How can I fix this?
CrossConnectivity.Current.ConnectivityChanged += async (sender, args) =>
{
var appdate = Preferences.Get("appdatetime", String.Empty, "private_prefs");
if (string.IsNullOrEmpty(appdate))
{
Preferences.Set("appdatetime", DateTime.Now.ToString(), "private_prefs");
}
else
{
if (DateTime.Now >= DateTime.Parse(Preferences.Get("appdatetime", String.Empty, "private_prefs")))
{
Preferences.Set("appdatetime", DateTime.Now.ToString(), "private_prefs");
if (CrossConnectivity.Current.IsConnected)
{
var ping = new Ping();
var reply = ping.Send(new IPAddress(pingipaddress), 5000);
if (reply.Status == IPStatus.Success)
{
lblStatus.Text = "Syncing data to server";
lblStatus.BackgroundColor = Color.FromHex("#2bcbba");
await Task.Delay(5000);
SyncFunction.SyncUser(host, database, contact, ipaddress, pingipaddress);
lblStatus.Text = "Online - Connected to server";
lblStatus.BackgroundColor = Color.FromHex("#2ecc71");
}
else
{
lblStatus.Text = "Online - Server unreachable. Connect to VPN";
lblStatus.BackgroundColor = Color.FromHex("#e67e22");
}
}
else
{
lblStatus.Text = "Offline - Connect to internet";
lblStatus.BackgroundColor = Color.FromHex("#e74c3c");
}
}
else
{
await DisplayAlert("Application Error", "It appears you change the time/date of your phone. Please restore the correct time/date", "Got it");
await Navigation.PopToRootAsync();
}
}
};
Detecting connectivity change across a VPN is not easy.
A workaround solution is to use a webservice as ping.
If you have a backend with API, this "ping" can be executed regularly to ensure the network AND the API are accessible.
This solution is to be used in addition to the connectivity check
Subscribe to connectivity changed
When conectivity looks OK, check the "ping service"
Typically in a mob app, this "ping endpoint" can be something like "/about".
Moreover, this specific service can be use to perform the compatibility version check beetween App Mob version and API version.
(look also Xamarin.Essentials to replace CrossConnectivity by Xamarin.Essentials: Connectivity, https://learn.microsoft.com/fr-fr/xamarin/essentials/connectivity?context=xamarin%2Fxamarin-forms&tabs=android)

Android Facebook Native ads error: 1001 no fill on user device

Our application use Facebook Native Ad via mediation platform Mopub, and it works good, but we should move to another platform.
I've replaced SDK platform, using the same placementId and app_id and tested my application as Developer.
Everything works good in test mode with real ads also, but I cannot get ads on real devices.
I tried to implement Facebook Native without any mediation platforms(code in the bottom), but still have the same result.
So the issue is not in partner platform,but I cannot get ads on real devices. Facebook Native throws error: 1001 no fill
It looks very strange, because I have:
Application has real users and shows ads in the previous version.
Application in PlayMarket(but with the previous implementation) with same package Id, placementId and app_id.
Facebook has checked my app.
I can see requests from new and previous version.
Code and logs:
AndroidManifest:
//...
//...
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
Application build.gradle:
//...
ext {
supportLibraryVersion = '25.3.1'
playServicesVersion = '11.0.1'
FBVersion = "4.25.0"
}
dependencies {
compile project(':library')
compile fileTree(include: ['*.jar'], dir: 'libs')
//...
compile "com.facebook.android:audience-network-sdk:$FBVersion"
//...
}
FacebookNativeLoader.java:
//...
/**
* Initiate ad container for native ad
*/
Override
public View createContentView(Context context) {
log(" createContentView");
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return inflater.inflate(R.layout.facebook_ad_native_view, null);
}
#Override
public void loadAd(final MyViewManager myViewManager, final ResultListener resultListener) {
log(" loadAd");
adNativeLayout = myViewManager.getContentView();
// Create ad request with Facebook ad PlacementId
adNative = new NativeAd(myViewManager.getContext(), adPlacementId);
//
adNative.setAdListener(new AdListener() {
#Override
public void onError(Ad ad, AdError adError) {
log("FacebookNative Ad Loading Failed." +
"Error:" + NATIVE_LOAD_ERROR +
" ErrorCode:" + adError.getErrorCode() +
" ErrorMessage" + adError.getErrorMessage());
//Call Error to hide ad layout
resultListener.onError(NATIVE_LOAD_ERROR);
}
#Override
public void onAdLoaded(Ad ad) {
log("FacebookNative Ad Loading Completed");
//...
// Download icon for native ad
if (adNative.getAdIcon() != null) {
String iconUrl = adNative.getAdIcon().getUrl();
if (iconUrl != null && iconUrl.length() > 0)
NativeAd.downloadAndDisplayImage(adNative.getAdIcon(), icon);
}
// Download cover for native ad
if (adNative.getAdCoverImage() != null) {
String coverUrl = adNative.getAdCoverImage().getUrl();
if (coverUrl != null && coverUrl.length() > 0)
NativeAd.downloadAndDisplayImage(adNative.getAdCoverImage(), contentImage);
}
//Show debug info
log("adNative.getCalltoAction() - " + adNative.getAdCallToAction());
log("adNative.getBody() - " + adNative.getAdBody());
log("adNative.getClickUrl() - " + adNative.getAdCallToAction());
BaseLockScreenManager.url = adNative.getAdCallToAction();
title.setText(adNative.getAdTitle());
text.setText(adNative.getAdSubtitle());
downloadButton.setText(adNative.getAdCallToAction());
// Add the AdChoices icon
LinearLayout adChoicesContainer = (LinearLayout) adNativeLayout.findViewById(R.id.ad_choices_container);
AdChoicesView adChoicesView = new AdChoicesView(myViewManager.getContext(), adNative, true);
adChoicesContainer.addView(adChoicesView);
//Call Success to show ads
resultListener.onSuccess(true);
}
#Override
public void onAdClicked(Ad ad) {
//Do something
}
#Override
public void onLoggingImpression(Ad ad) {
//Do something
}
});
//Register Ad container to catch user Interactions
adNative.registerViewForInteraction(adNativeLayout);
// Initiate a request to load an ad.
// Loading Ad started here...
adNative.loadAd();
}
In Facebook documentation "error: 1001 no fill" means:
This is a common error seen while testing, and relates to a "No Fill"
response; the most common reason for this is the user is not logged in
to the Facebook App when testing your mobile app or not logged in to
the Facebook mobile website when testing your mobile website.
Error 1001 - No Fill. May be due to one or more of the following:
- User not logged into Native Facebook App on Mobile Device(But real device logged into Native Facebook App)
Limit Ad Tracking turned on (iOS)(but this is not relevant for Android app)
Opt out of interest-based ads turned on (Android) (but I've turned value off)
No Ad Inventory for current user (What does it mean?)
Your testing device must have the native Facebook application installed.(but I tested on real device with real Facebook account)
Your application should attempt to make another request after 30 seconds.(but I'have the same result everytime)
LogCat messages:
Developer device:
FacebookLoader:
I/----FacebookLoader: loadAd
I/----FacebookLoader: createContentView
I/----FacebookLoader: Facebooknative Ad Loading Completed
I/----FacebookLoader: adNative.getCalltoAction() - Learn More
I/----FacebookLoader: adNative.getBody() - LAToken aims to tokenize assets worth $1.2 trillion by 2025.
I/----FacebookLoader: adNative.getClickUrl() - Learn More
User Device:
FacebookLoader:
I/----FacebookLoader: loadAd
I/----FacebookLoader: createContentView
I/----FacebookLoader: FacebookNative Ad Loading Failed.Error:669 ErrorCode:1001 ErrorMessage: No fill
What can be issue of it? Has somebody the same issue?
I'm afraid to make release without ability to be sure that user can see ads, because the main idea of our application is Advertisement.
step 1: goto play store download native Facebook app install and login
step 2: Then test your app "testing add loading success"
Other errors like : " FacebookAdapter: No fillI/TAG: No fill.I/Ads: Ad failed to load : 3"
then : goto Manifest file and add on application level : android:usesCleartextTraffic="true"
<application
.........
android:usesCleartextTraffic="true"
.......
/>

The given key was not found in the dictionary

I'm developing windows phone 8 application. In this, I have to integrate Twitter. So I have followed the below tutorial.
http://code.msdn.microsoft.com/wpapps/Latest-Twitter-integration-a42e8bb6
I've implemented successfully twitter in my application. I've tested this in Emulator and in device also. Everything was fine.
**Suddenly in the device the application is unable to open the twitter log in page. I'm getting the error in the below method at line started with .
void requestTokenQuery_QueryResponse(object sender, WebQueryResponseEventArgs e)
{
try
{
StreamReader reader = new StreamReader(e.Response);
string strResponse = reader.ReadToEnd();
var parameters = MainUtil.GetQueryParameters(strResponse);
**OAuthTokenKey = parameters["oauth_token"];**
tokenSecret = parameters["oauth_token_secret"];
var authorizeUrl = AppSettings.AuthorizeUri + "?oauth_token=" + OAuthTokenKey;
Dispatcher.BeginInvoke(() =>
{
this.loginBrowserControl.Navigate(new Uri(authorizeUrl, UriKind.RelativeOrAbsolute));
});
}
catch (Exception ex)
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show(ex.Message);
pi.IsVisible = false;
});
}
}
The given key was not present in the dictionary.
But in Emulator I'm successfully redirected to log in page if user is not logged in and posting the message.
I don't know what is the problem in the device.
This issue occurs when the the device you are using for testing the app is without simcard, as it the device without the simcard cannot match the timings of the twitter api server and this mismatch causes the authentication error, as for the api the credentials are invalid due to heavy difference in the timings between api server and device, hence try checking it on a device that has a simcard inside.

WP7 Push notifications not working after app has been published

I'm using toast notifications for my phone app. When the app is first started on someones phone it will get the push notification URL and then store it in our database so we can send notifications down to the user.
In testing, using both the emulator and testing on my HTC WP7 the notification was found and uploaded.
Now the application is in the store, notification URL's are coming to the server as NULL. In the app dashboard I'm getting the following:
Missing certificate for authenticated push notifications: Certificate for authenticated push notifications
Would this be causing the issue? If so, how do I go about getting this certificate? I can't find anything relating to this anywhere.
Below is a code snippet, which worked in testing but since publishing to the store is always returning NULL:
private void BindChannel()
{
channel = HttpNotificationChannel.Find(channelName);
if (channel == null || channel.ChannelUri == null)
{
if (channel != null) DisposeChannel();
channel = new HttpNotificationChannel(channelName);
channel.ChannelUriUpdated += channel_ChannelUriUpdated;
channel.Open();
}
else
{
StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri);
}
SubscribeToChannelEvents();
if (!channel.IsShellTileBound) channel.BindToShellTile();
if (!channel.IsShellToastBound) channel.BindToShellToast();
string notificationUri = string.Empty;
if (StorageSettings.TryGetSetting<string>("NotifyURL", out notificationUri))
{
if (notificationUri != channel.ChannelUri.AbsoluteUri)
{
StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri);
}
}
else
{
if (channel.ChannelUri != null)
{
StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri);
}
}
}
Actully i am getting also null url but in my side its WNS not responding after some time it will working fine.
And I think bellow link may be help you
Overview of pushnotification
How to authenticate with the Windows Push Notification Service (WNS) (Windows)

HttpWebRequest and WebClient returning NotFound on Windows Phone 7 but not i normal console application

I'm trying to download a regular JSON string from this url https://valueboxtest.lb.dk/mobile/categories from a Windows Phone 7 Application.
I have tried to both use WebClient and HttpWebRequest. They both throw an exception
“The remote server returned an error: NotFound”
This is the code for using the WebClient
var webClient = new WebClient();
webClient.DownloadStringCompleted += (client_DownloadStringCompleted);
webClient.DownloadStringAsync(new Uri("https://valueboxtest.lb.dk/mobile/categories"));
The eventhandler then just show the content, but e.Result throws the above mentioned exception:
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null && !e.Cancelled) MessageBox.Show(e.Result);
}
For the HttpWebRequest my code looks as follows:
var httpReq = (HttpWebRequest)WebRequest.Create(new Uri("https://valueboxtest.lb.dk/mobile/categories"));
httpReq.BeginGetResponse(HTTPWebRequestCallBack, httpReq);
With the following callback:
private void HTTPWebRequestCallBack(IAsyncResult result)
{
var httpRequest = (HttpWebRequest)result.AsyncState;
var response = httpRequest.EndGetResponse(result);
var stream = response.GetResponseStream();
var reader = new StreamReader(stream);
this.Dispatcher.BeginInvoke(
new delegateUpdate(update),
new Object[] { reader.ReadToEnd() }
);
}
And with the delegate method
delegate void delegateUpdate(string content);
private void update(string content)
{
MessageBox.Show(content);
}
Running it in a console application
Everything works just fine and the JSON string is returned with no problems and I am able to print the result to the console.
Different URL does work on WP7
The weird thing is that the URL http://mobiforge.com/rssfeed actually works fine in both of the above mentioned scenarios.
This issue occurs both in the Emulator and on an actual device.
What could be wrong? Is the REST service returning the data in misbehaving way? I really hope you can help me!
Note: I'm not running Fiddler2 at the same time!
The reason is because that site does not have a valid certificate. Just try it on Mobile Internet Explorer and you'll get the prompt about an issue with the certificate.
How to ignore SSL certificates
Mobile devices are stricter when it comes to SSL certificates.
If you want to get this app into a production environment, you'll either need to write a wrapper for this server (if it's not your own), or get a valid certificate. In the short-term, for testing, you can add a certificate into your device.
Here's a tool which might help you install a certificate.

Resources