freshstate / CurrentActivityPlugin

Always grab the current Activity of your Xamarin.Android app!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Current Activity Plugin for Xamarin.Android

This plugin gives developers and library creators easy access to an Android Application’s current Activity that is being displayed.

Want to read about the creation, checkout my in-depth blog post.

Setup

Build Status: Build status

Platform Support

Platform Supported Version
Xamarin.iOS --- iOS 6+
Xamarin.iOS Unified --- iOS 6+
Xamarin.Android Yes API 14+
Windows Phone Silverlight --- 8.0+
Windows Phone RT --- 8.1+
Windows Store RT --- 8.1+
Windows 10 UWP --- 10+
Xamarin.Mac ---

API Usage

Call CrossCurrentActivity.Current from any project or PCL to gain access to APIs.

Activity

/// <summary>
/// The Current Activity
/// </summary>
Activity Activity { get; set; }

That’s it! Well not really:

Application Setup When you install this plugin a MainApplication.cs is installed into your android project. If you already have an Application class then you should copy over the important bits that can be found in the Readme file that was also installed in the PluginsHelp folder

Library Creators Simply set this nuget as a dependency of your project to gain access to the current activity. This can be achieved by setting the following in your nuspec:

<dependencies>
  <group targetFramework="MonoAndroid10">
    <dependency id="Plugin.CurrentActivity" version="1.0.1"/>
  </group>
</dependencies>

Thanks!

License

Licensed under main repo license

About

Always grab the current Activity of your Xamarin.Android app!

License:MIT License


Languages

Language:C# 65.0%Language:PowerShell 24.6%Language:Pascal 10.3%