hunk.code_window: ### `MediaLibrary.createAssetAsync(localUri)`
   Creates an asset from existing file. The most common use case is to save a picture taken by [Camera](../camera/).
   ```js
   const { uri } = await Camera.takePictureAsync();
  
hunk.labels: keep keep keep replace keep keep keep
hunk.after_edit: Creates an asset from existing file. The most common use case is to save a picture taken by [Camera](../camera/). This method requires `CAMERA_ROLL` permission.
  
hunk.file_path: docs/pages/versions/unversioned/sdk/media-library.md
hunk.type: replace
file: package abi37_0_0.expo.modules.keepawake;
  
  import android.app.Activity;
  import android.view.WindowManager;
  
  import abi37_0_0.org.unimodules.core.ModuleRegistry;
  import abi37_0_0.org.unimodules.core.errors.CurrentActivityNotFoundException;
  import abi37_0_0.org.unimodules.core.interfaces.ActivityProvider;
  import abi37_0_0.org.unimodules.core.interfaces.InternalModule;
  import abi37_0_0.org.unimodules.core.interfaces.services.KeepAwakeManager;
  
  import java.util.Collections;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  
  public class ExpoKeepAwakeManager implements KeepAwakeManager, InternalModule {
  
    private ModuleRegistry mModuleRegistry;
    private Set<String> mTags = new HashSet<>();
  
    @Override
    public void onCreate(ModuleRegistry moduleRegistry) {
      mModuleRegistry = moduleRegistry;
    }
  
    private Activity getCurrentActivity() throws CurrentActivityNotFoundException {
      ActivityProvider activityProvider = mModuleRegistry.getModule(ActivityProvider.class);
      if (activityProvider.getCurrentActivity() != null) {
        return activityProvider.getCurrentActivity();
      } else {
        throw new CurrentActivityNotFoundException();
      }
    }
  
    @Override
    public void activate(final String tag, final Runnable done) throws CurrentActivityNotFoundException {
      final Activity activity = getCurrentActivity();
  
      if (!isActivated()) {
        if (activity != null) {
          activity.runOnUiThread(() -> activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON));
        }
      }
      mTags.add(tag);
      done.run();
    }
  
    @Override
    public void deactivate(final String tag, final Runnable done) throws CurrentActivityNotFoundException {
      final Activity activity = getCurrentActivity();
  
      if (mTags.size() == 1 && mTags.contains(tag) && activity != null) {
        activity.runOnUiThread(() -> activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON));
      }
      mTags.remove(tag);
      done.run();
    }
  
    @Override
    public boolean isActivated() {
      return mTags.size() > 0;
    }
  
    @Override
    public List<? extends Class> getExportedInterfaces() {
      return Collections.singletonList(KeepAwakeManager.class);
    }
  }
  