Implement the BlackBerry Dynamics Launcher
BlackBerry Dynamics Launcher
You have the option to implement the
BlackBerry Dynamics Launcher
, an intuitive front-end UI that makes it easy for device users to access and modify settings for BlackBerry
Dynamics
apps. For more information, see the documentation for the BlackBerry Dynamics Launcher Framework.To implement the
BlackBerry Dynamics Launcher
, you add the BlackBerry Dynamics Launcher
button to an activity and include its authentication logic in the appropriate place in your app.- Download theBlackBerry Dynamics LauncherBindings for .NET software from BlackBerry Developer Downloads.
- In your IDE, load the NuGet binding packages into the desired projects. For each project, right-clickDependenciesand clickManage NuGet Packages...to reference the Launcher binding. For more information, see Load bindings for a new project.
- In your app, include the following packages:using Com.Blackberry.Launcher; using Com.Good.Launcher;
- Add theBlackBerry Dynamics Launcherto the activity that you want it to appear on. TheBlackBerry Dynamics Launchercan be initialized using either an inclusive or exclusive list of activities. If an inclusive list is used, theBlackBerry Dynamics Launcheris shown only on the included activities.In this example, theBlackBerry Dynamics Launcheris only added to the main activity:var includedActivities = new List<Java.Lang.Class> { Java.Lang.Class.FromType(typeof(MainActivity)) }; GDLauncher.InitForApplication(this, includedActivities, LauncherButton.ActivitiesTargetingMethod.Inclusive, this);You can also use an initialization API for all activities:GDLauncher.InitForApplication(this, this);
- Implement ILauncherDelegate and pass it to InitForApplication. Optionally, override the default implementation.// Override default interface implementation void ILauncherDelegate.OnSettingsCommand() { Toast.MakeText(this, $"Launcher version: {GDLauncher.Version}", ToastLength.Short).Show(); }
- To get broadcast receivers to pass authorization events, ApplicationInit is mandatory before calling GDLauncher.InitForApplication in the application OnCreate method.public override void OnCreate() { base.OnCreate(); GDAndroid.Instance.ApplicationInit(this); // Initialize launcher GDLauncher.InitForApplication(this, this); }
- Add the following authorization code to the appropriate place in your app that authenticates users. Usetrueorfalseas appropriate.HostingApp.Instance.SetAuthorized (true);