Migrate to Xamarin 3.3.2.5

Overview

With the 3.3.2.5 release, the Action subsystem has changed. The new subsystem is much more flexible, but requires that you modify your existing code.

Before you begin

Install an app with the Xamarin 3.3.2.4 SDK (or earlier).

Add onStop and OnStart and MainActivity.cs on Android

Add the following to the MainActivity.cs class in the Android subproject:

protected override void
OnStop
()
{
    base.
OnStop
();
    IBMMobilePushImpl.
OnStop
();
}
protected override void
OnStart
()
{
    base.
OnStart
();
    IBMMobilePushImpl.
OnStart
();
}

Remove old plug-in files

Do not use mce/plugins/json* files anymore.

Update OnCreate in MainActivity.cs

In MainActivity.cs's OnCreate method, remove:

var jsonActionString =
this
.
Intent
.
GetStringExtra
(
"action"
);
if
(jsonActionString !=
null
)
{
    var jsonAction = JObject.
Parse
(jsonActionString);
    JObject jsonPayload =
null
;
if
(
this
.
Intent
.
HasExtra
(
"payload"
))
{
        jsonPayload = JObject.
Parse
(
this
.
Intent
.
GetStringExtra
(
"payload"
));
}
    var attribution =
this
.
Intent
.
GetStringExtra
(
"attribution"
);
int id=
0
;
try
{
        id = Int32.
Parse
(
this
.
Intent
.
GetStringExtra
(
"id"
));
}
catch
{
}

    var mailingId =
this
.
Intent
.
GetStringExtra
(
"mailingId"
);
    LoadApplication(
new App(jsonAction, jsonPayload, attribution, mailingId, id));
}
else
{
    LoadApplication(
new App());
}

and replace it with:

LoadApplication(
new App());

Update the application's main class

Remove the following code from Application's main Class:

public
App
(JObject jsonAction =
null
, JObject jsonPayload =
null
, String attribution =
null
, String mailingId =
null
,
int id =
0
)

and replace it with

public
App
()

Next, remove the following code from the main class:

if
(jsonAction !=
null
)
{
    SDK.
Instance
.
ExecuteAction
(jsonAction, jsonPayload, attribution, mailingId, id);
}

Did this page help you?