Search Unity

Resolved Use Download Manager without Android Activity class

Discussion in 'Android' started by Clashman, Jun 3, 2021.

  1. Clashman

    Clashman

    Joined:
    Feb 18, 2019
    Posts:
    53
    Hi !

    I have little problem... I need to use Android Download Manager.
    This object take in parameter the context of an activity.
    However, my boss doesn't use Activity class with a plugin or a library like Xamin but he made his own activity class. He reinvented the wheel !
    In which way can I use his Activity class with Download Manager ?

    Thanks for answers !
     
  2. Clashman

    Clashman

    Joined:
    Feb 18, 2019
    Posts:
    53
    I resolved my problem.

    Code (CSharp):
    1. var currentContext = Android.App.Application.Context;
    2. var manager = DownloadManager.FromContext(currentContext);