Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

[RELEASED] Android Local Gallery Plugin

Discussion in 'Assets and Asset Store' started by TAO_Chisato, Mar 22, 2018.

  1. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    We are really glad to introduce Android Local Gallery Plugin.
    https://assetstore.unity.com/packages/tools/integration/android-local-gallery-plugin-110680

    Please check the following video. It shows all features.


    [Features]

    Local Gallery
    -Query all videos and photos which is stored in the local storage.
    -Query all photos which is stored in the local storage.
    -Query all videos which is stored in the local storage.
    -Query all folders which has photos or videos in the local storage.
    -Suppport offset and limit query.
    -Suppport sort.

    Recyclable Grid ScrollView
    -Using recyclable grid layout which can use with uGUI.
    -Direction support.(Vertical, Horizontal)
    -Can change Column.(1 or more)
    -Can change recycle item count.(1 or more)
    -Optimized memory performance.
    -60 fps smooth scroll on Galaxy S8.

    Demos
    -Android Local Gallery with Recyclable Grid ScrollView.

    Others
    -Using Standard Unity Activity.(This asset has an AndroidManifest which only added WRITE_EXTERNAL_PERMISSION)
    -Demo supports runtime permission. You will need WRITE_EXTERNAL_PERMISSION to read photos and videos from phone storage.

    We recommend you to try a demo app before you download it.
    https://play.google.com/store/apps/details?id=jp.co.taosoftware.android.localgallery.library

    Thank you for reading.
    Please feel free to share what you think and give us a feedback.
     
    Last edited: Mar 23, 2018
  2. michaelnoinc

    michaelnoinc

    Joined:
    Jan 16, 2017
    Posts:
    3
    Is it possible to make the plugin pull up more than just photo and video file types? Or rather where would I start to begin figuring that out?
     
  3. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Thank you for asking.
    It's not possible for now, but it's feasible to add audio files from next version.
    If you want to pull other files aside from photo, video and audio files, we need a time to develop and test.
     
  4. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Following video introduces new features.
    *We don't know when it will be updated on Unity Asset Store.

    Version v1.1.0
    -Audio type support.
    -Added mime type filter.(Beta version)
     
  5. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Android Local Gallery Plugin is just updated.
    https://assetstore.unity.com/packages/tools/integration/android-local-gallery-plugin-110680

    You can pull audio files through following method.
    Code (CSharp):
    1. public void getFiles(
    2.     string folderDir,
    3.     int[] mediaTypes,
    4.     string[] mimeTypes,
    5.     string sortOrder,
    6.     int offset,
    7.     int limit,
    8.     AndroidGalleryManager.onMediaCallback callback
    9. )
    Pull photo and video files.
    Code (CSharp):
    1. androidGalleryManager.getFiles (folderDir, new int[]{ FileColumns.MEDIA_TYPE_IMAGE, FileColumns.MEDIA_TYPE_VIDEO }, sortOrder, itemOffset, itemCount, onMediaCallback);
    Pull audio files.
    Code (CSharp):
    1. androidGalleryManager.getFiles (folderDir, new int[]{ FileColumns.MEDIA_TYPE_AUDIO }, sortOrder, itemOffset, itemCount, onMediaCallback);
    Pull pdf files.
    Code (CSharp):
    1. androidGalleryManager.getFiles (folderDir, new int[]{ FileColumns.MEDIA_TYPE_NONE }, new string[]{"'application/pdf'","'application/x-pdf'"}, sortOrder, itemOffset, itemCount, onMediaCallback);
    These samples are applied to the DemoScene_GridAndGallery.unity
    You also can check the behaviors through demo app.
    https://play.google.com/store/apps/details?id=jp.co.taosoftware.android.localgallery.library

    Thanks
     
  6. michaelnoinc

    michaelnoinc

    Joined:
    Jan 16, 2017
    Posts:
    3
    Thanks a bunch for the update, that definitely opens up options. I tried, 'application/octet-stream' for the mimetype filter and that doesn't seem to return anything though. My goal is to be able to view between just media type files and all files, and preferably in folder view. But the getAllFolders() method doesn't seem to support the mimetype stuff yet.
     
  7. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Thank you for checking about new features.
    >tried, 'application/octet-stream' for the mimetype filter and that doesn't seem to return anything though.
    We will investigate about it.
    > But the getAllFolders() method doesn't seem to support the mimetype stuff yet.
    Yes. You're right. Actually 'Native Library' supports getAllFolder with mimetype but AndroidGalleryManager doesn't have the method. We will add the method which supports mimetype from next version.

    Thank you so much.
     
  8. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    We submitted a new version of Android Local Gallery Plugin to the Unity Asset Store.
    Unity will review it.


    >application/octet-stream' for the mimetype filter and that doesn't seem to return anything though.
    Will you please try the latest version of demo app. it supports custom mime type.
    https://play.google.com/store/apps/details?id=jp.co.taosoftware.android.localgallery.library

    We guess that the file which you want to pull has a 'null' mime type.
    You can pull all other type of files[mediaType: other, mimeType:none] via latest demo app.
    The detail shows a mimetype like a following capture.
    device-2018-06-27-151234.png device-2018-06-27-152210.png
    > But the getAllFolders() method doesn't seem to support the mimetype stuff yet.
    getAllFolders will support mimetype like a capture below.
    device-2018-06-27-151959.png device-2018-06-27-152033.png

    Thank you.
     
    Last edited: Jun 27, 2018
  9. yogasanauk

    yogasanauk

    Joined:
    Nov 28, 2017
    Posts:
    3
    Hi I bought the asset and integrated into my project nothing shows? Though the Demo Scenes do work. The only thing that is different is the manifest files

    mine is

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.deadmosquitogames.androidgoodiesdemo.assetstore"
    android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
    android:xlargeScreens="true" android:anyDensity="true"/>
    <uses-feature android:glEsVersion="0x00020000"/>
    <supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture"/>
    <application android:theme="@StyLe/UnityThemeSelector" android:icon="@drawable/app_icon"
    android:label="@String/app_name" android:debuggable="true" android:isGame="true">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@String/app_name"
    android:screenOrientation="fullSensor" android:launchMode="singleTask"
    android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
    <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
    </activity>
    <!-- Needed for Android Goodies photo picker -->
    <provider
    android:name="com.deadmosquitogames.multipicker.utils.AMPFileProvider"
    android:authorities="com.yogasana.fullapp.multipicker.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
    android:name="android.support.FILE_PROVIDER_PATHS"
    android:resource="@XML/paths"/>
    </provider>
    <!-- Local push notifications -->
    <receiver android:name="com.deadmosquitogames.notifications.GoodiesNotificationManager"/>
    <!-- Unity requests all the runtime permissions when you application starts, all in a row. Uncomment these lines to prevent this from happening-->
    <!--<meta-data-->
    <!--android:name="unityplayer.SkipPermissionsDialog"-->
    <!--android:value="true"/>-->
    </application>
    <!-- PERMISSIONS -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <!-- ANDROID GOODIES TEST APP PERMISSIONS -->
    <!-- Modify screen brightness -->
    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
    <!-- To open bluetooth settings on some devices -->
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <!-- To be able to set phone wallpaper -->
    <uses-permission android:name="android.permission.SET_WALLPAPER"/>
    <!-- For dialing phone number directly functionality -->
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <!-- For GPS coordinates -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <!-- Flashlight -->
    <uses-permission android:name="android.permission.CAMERA" android:required="false"/>
    <uses-feature android:name="android.hardware.camera"/>
    <uses-permission android:name="android.permission.FLASHLIGHT"/>
    <uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
    <!-- For testing runtime permissions -->
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
    <uses-permission android:name="android.permission.READ_CALENDAR"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <!-- For contact picker -->
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <!-- For fingerprint scanner -->
    <uses-permission android:name="android.permission.USE_FINGERPRINT"/>
    <!-- For audio recording -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <!-- For GPS coordinates -->
    <!-- Needed only if your app targets Android 5.0 (API level 21) or higher. -->
    <uses-feature android:name="android.hardware.location.gps" android:required="false"/>
    <!-- END ANDROID GOODIES TEST APP PERMISSIONS -->
    <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
    </manifest>


    The phone supplied is

    <?xml version="1.0" encoding="utf-8"?>
    <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="preferExternal"
    android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <supports-screens
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:anyDensity="true"/>
    <application
    android:theme="@StyLe/UnityThemeSelector"
    android:icon="@drawable/app_icon"
    android:label="@String/app_name">
    <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
    <meta-data android:name="android.max_aspect" android:value="2.1" />
    <activity android:name="com.unity3d.player.UnityPlayerActivity"
    android:label="@String/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    </application>
    </manifest>

    Do I need to put the application data in?
     
  10. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Thank you for asking.

    Your manifest file looks correct.
    Android Local Gallery Plugin works with a following permission and UnityPlayerActivity.
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    or
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    >Though the Demo Scenes do work. The only thing that is different is the manifest files
    We would like to ask you for confirmation even if you already know about following questions.

    1. Build options
    Check minimum API Level is 4.4 or higher.
    Check target API Level is 6.0 or higher.

    2. Existence of the following files in your project hierarchy.
    *AndroidGalleryManager object which attaches AndroidGalleryManager.cs
    *RuntimePermission object which attaches RuntimePermission.cs

    3. Existence of the following files in your project directory.
    *Assets/Plugins/Android/androidgallerylibrary-release.aar

    If it's not solved, we would like you to send us the application data through the e-Mail.
    https://assetstore.unity.com/publishers/17009


    Thank you
     
  11. Y76_Unity

    Y76_Unity

    Joined:
    Jan 29, 2018
    Posts:
    28
    what about iOS ? is there another asset that supports iOS File System?
     
  12. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Thank you for asking.
    We tried to find similar asset for iOS but we only could find assets which can pick and store images through aOS and iOS native API.
     
  13. jasonmcguirk

    jasonmcguirk

    Joined:
    Apr 20, 2013
    Posts:
    10
    I think there's a bug with the MediaData parsing thats causing a overflow on date_taken

    /// <summary>
    /// <para>The date and time that the image was taken in units of milliseconds since jan 1, 1970.</para>
    /// <para>Type: INTEGER (long)</para>
    /// </summary>
    public int date_taken = 0;

    This is causing the date_taken values to be negative

    Could you take a look at making sure this is passed as a long (or is converted to seconds prior to leaving java)

    Cheers!
     
  14. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    Thank you for your feedback.
    We're going to investigate it.

    Thanks!
     
  15. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    We investigated it and you are right.
    Android reference said that it is the integer type but it will bring the problem like you said.
    https://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns#DATE_TAKEN

    We can see the correct values when we changed convert type from Integer to Long.

    We will update it after test.

    Thank you so much!
     
    Last edited: Feb 19, 2019
  16. TAO_Chisato

    TAO_Chisato

    Joined:
    Mar 22, 2018
    Posts:
    11
    We fixed the problem which you told us before.
    New version is already live.

    Demo App is also updated to v1.1.3 so you can check the correct date_taken value.
    https://play.google.com/store/apps/details?id=jp.co.taosoftware.android.localgallery.library
    device-2019-02-21-142248.png
     
    Last edited: Feb 21, 2019
  17. hamzatahirful

    hamzatahirful

    Joined:
    Jul 23, 2017
    Posts:
    2
    Hi. I have bought your asset but it does not work on android 10. Please help!!