WP7 how to store LiveConnectSession during TombStoning? - windows-phone-7

I'm using the windows live sign in strategy of the PhotoSkyOnTheGo example provided by MS. So when my app starts, it shows a windows live sign in page.
During app runtime I remember the LiveConnectSession to connect to SkyDrive.
Now when the app tombstones, I need a way to save the LiveConnectSession. IsolatedStorageSettings.ApplicationSettings does not work, probably because the LiveConnectSession is not serializable (it shows some InvalidDataContractException in the debug output).
So how do I store the Session in case the app tombstones? Or is the provided PhotoSkyOnTheGo-example rubbish and I need to be able to reconnect anytime I'm accessing SkyDrive?

If your app uses wl.offline_access scope than the live:SignInButton control saves it for you and loads it automatically. Just use the SessionChanged event to capture the session object. This way the user will need to sign in only once.
Scope:
http://msdn.microsoft.com/en-us/library/live/hh243646.aspx#wlofflineaccess
Event:
http://msdn.microsoft.com/en-us/library/live/microsoft.live.controls.signinbutton.sessionchanged.aspx

Related

Google Scripts Web App: How to View User Session

I am using Google Apps Script (GAS) to host a web app. I would like to be able to see the "session" so that if the user opens the page more than once, I can see the session information for the given user/browser. I currently control all that on the client side, but it would be MUCH neater if it were all on the server side (for example, what if an error occurs when fetching the page?). This is especially important for properly handling user logins... it's so ugly handling it all on the client side.
I'm used to applications like ASP, ASP.NET, and PHP which have sessions and session variables. Does GAS have anything like that for their web apps? Thanks!
EDIT: To be clear, I'm running the web app as Me, so I can't tell who is logged in by their Google account. Users don't need a Google account to access the page.
Check out the video on using google analytics in google apps script. It was presented by one of the top App Script developers who uses this technique in his tools. It allows tracking users actions/errors individually and in aggregate.
https://youtu.be/r_S7NeidzI0?t=1869

Where exactly Android Wear app Permission request to be placed

I want to request the permissions that I need for my android wear app upfront as per this. So Programmatically where exactly I should put my permission request code. Also is the protocol to ask for Permission the same as the mobile app like this.
All of the permissions are controlled in the Androidmanifest. Here is an example of some permissions being declared in the Androidmanifest:
These permissions are used to get the weather from the device and relay the information to an Android Wear device. Google offers documentation for developers to use to determine what permissions should be used. Declaring permissions should happen in the Androidmanifest in the format provided in the image. In the sample code posted, it is not necessary to include watch permissions, they are only required if the app works with Android Wear.
Way back in the day Google added a feature in Android 4.3 that let the user control what permissions apps could access on a per app basis known as App Ops. This was a great feature that cut down on privacy issues and gave users the piece of mind knowing that random apps installed could not access the device’s location. When Google introduced Android 6.0 Marshmallow, This time when an app needs to use a permission a dialog box pops up on the screen and asks the user if it is OK that the app uses a certain permission. This may get a little annoying, but at least every permission used by an app has to go through the user first.
If your app doesn't already have the permission it needs, the app must call one of the [requestPermissions()](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.html#requestPermissions(android.app.Activity, java.lang.String[], int)) methods to request the appropriate permissions. Your app passes the permissions it wants, and also an integer request code that you specify to identify this permission request. This method functions asynchronously: it returns
right away, and after the user responds to the dialog box, the system calls the app's callback method with the results, passing the same request code that the app passed to requestPermissions().
You should dynamically request the permissions from user on wearable devices just the same way you do on the phone side.

Issues with A background URLSession with identifier

I tried this code in my project to download large files in background and it works fine. I start downloading in UIViewController. If I go to another view and back to the UIViewController ,it stop reloading the progress bar.
I got the Issues with A background URLSession with identifier already exists!. I Want to create new session every time when UIViewController load. I want invalidate all background session when dismiss the view controller. I tried all possibilities to resolve this issue but don’t get succeed.
Click Here
When you create a background session, you're doing two things:
Telling nsurlsessiond (a background daemon) to create a session.
Creating a local session in your app that is connected to that session.
The purpose of the identifier is to allow your app to reconnect to the external session (controlled by nsurlsessiond) if your app gets terminated by the operating system.
To my knowledge, it is not normally possible for your app to voluntarily dissociate its session from the background session. So when your app tries to create a session with the same identifier, suddenly there are two sessions that are both trying to talk to the same external session in nsurlsessiond, and things go very wrong. That's not a supported way to use the API.
The background session object must be kept alive the entire time that your app is running. Don't try to dispose of it and recreate it within a single launch. You should not ever create a session with the same ID unless your app gets relaunched.
Note, however, that if your app gets relaunched to handle background events (iOS only), when you call the completion handler provided by the event, your app's local session does get invalidated, and you need to create it if your app does anything after that. That's the only situation I'm aware of where a background session ever stops being associated with the background session in nsurlsessiond, and thus that's the only situation where you should ever create a session with the same ID twice in a single launch (once when you're asked to handle background events, and then potentially again when you get a didFinishLaunching call to indicate that the user foregrounded your app).

How to create an FB app without a secure canvas URL

I have a simple app I want to create, which allows you to place any website within your Facebook page on a tab.
Previously, I could just do this without a secure canvas URL, but now it is telling me that I must have this to create the app.
Is there a way around this, as the app does not take any info from anybody, it just shows a site from my server on the page.
Short answer: No. You do not need to provide an encrypted connection if the app runs in sandbox mode but otherwise it is mandatory.
Well, actually people using secure browsing will just see an error message at the moment but judging from recent announcements apps without an encrypted connection will be blocked a bit further down the road.

asp.net - maintain session while debugging and rebuilding solution?

I'm writing an asp.net Web Application. I wrote a login page that authenticates a user and stores their UserID in the Session["UserID"]. Every page in the web application will check for a valid Session["UserID"]. If not valid, then redirect the user to the login screen.
This works great, but it's slowing down my ability to debug every page on my website. Each time I make a change to a *.cs file, I need to press F6 to rebuild my solution. Doing this destroys my session, which means I need to go back to the login screen, type my username and password, click to the page I was working on, do my tests, make code changes to my code, and repeat.
Is there a way to keep my session alive everytime I re-build my solution so I don't have to go to the login page every single time?
Unfortunately, I don't know that you will find any way around this limitation. Every time you build your project, you are going to trigger a restart of the web application. Even if you were to use a persistent store for keeping sessions, you're going to lose the session cookie being set in your browser.
You could add a "remember me" feature to your app. You'd need to do a little reimplementation, in order to keep the information about the current user authentication in a data store that is less volatile than ASP.NET session state. Also, you'd store the index to that information in a cookie that is more persistent than a session cookie.
That's the best I can think of, or at least it's the best I can think of without some significant extensions to the .NET security providers. However, take it with a grain of salt -- I've never tried to solve this particular problem before, and I hardly consider myself an expert in all things ASP.NET session-related.
The reason why you lose your session is because your application is restarted when you write to the application folder. In fact the same thing happens when you publish your application, every user currently logged in will lose their session.
This is intentional because they have no way of knowing that the DLL's you were using in your page are still there or not. So instead they monitor the folders themselves and trigger a restart when you write to them.
There is no workaround for this. It's in fact a feature that saves you time (most of the time), imagine tracking down memory corruption errors because the pointers moved around in your code!

Resources