Skip to content

Migration

Benedikt Hensen edited this page Oct 18, 2018 · 4 revisions

Migration to other Systems

This page contains some important aspects for the migration of the framework to other systems:

General

The main functionality which requires platform-dependent changes is the authorization procedure:

The authorization uses the service by the Learning Layers. The application is registered at this service as a client. If the user authorization succeeds, the login website redirects to the custom URL-scheme gamr://. This URL-scheme has been defined as the redirect URL at the learning layers. The app needs to react to this URL-scheme so that it automatically reopens after authorization. This step is also important as it receives the access token from the parameters of the redirect URL. Since this reaction behavior is platform-dependent, it needs to be defined individually for each platform.

Make sure that the platform-specific application can react on the URL-scheme gamr://. For instance on the Universal Windows Platform this has to be defined as a protocol in the manifest file.

Moreover, the final application also needs to contain platform specific code which can query whether the application was launched due to the URL-scheme. It also needs to be able to query for the URL in order to store the access token which is included in the redirect URL of the Learning Layers authorization. The extracted access token can be stored in the AuthorizationManager. It the using statement using UnityEngine is added to the generated file, the game object which contains the AuthorizatonManager can be accessed the same way as in any other script by GameObject.Find().

Search for an event or a callback function in the generated app which is triggered if the application is (re-)opened due to the URL-scheme. Make sure that it is possible to query for the exact URL-address to get its parameters, i.e. the access token. Extract the access token and transfer it to the AuthorizationManager.

Universal Windows Platform

On the universal windows platform, the URL-scheme is defined as a protocol in the app-manifest. The code which stores the access token from the redirect URL can be found in the generated App.cs in the function ApplicationView_Activated.

The changes to the platform-specific application only need to be performed once after Unity generates the app for the first time. After this Unity will only update the created solution but the code is not regenerated. Thus, the changes for the custom redirect URL are preserved if the app is re-generated.

See also

Clone this wiki locally