Forum Libraries, Components, and Plugins

Android operations with MediaPlugin results in number of issues.

Hi,

Implemented the POC project with the MediaPlugin (Latest stable release 2.6.2) and which works great, however with the actual project commands in action resulted in multiple errors which, I am not able to interpret/understand properly. Xamarin Forms version 2.3.4.247

Unable to find explicit activity class {Discoverability.Droid/md5a3e164e78ade0c22cefea770ddd0bc49.MediaPickerActivity}; have you declared this activity in your AndroidManifest.xml?

Clicking again gives a different error (not only the same operation - for any operation gives the same error).

Only one operation can be active at a time

Followed full steps as suggest on the Git repository page.
i.e. Updated AndroidManifest.xml AND Updated MainActivity.cs file with the overridden OnRequestPermissionsResult()'. Added the xml folder and file_paths.xml

The following is the method which I've implemented as per project requirement, really not much different then the sample application.

What am I missing?
Please suggest a remedy for the same at earliest.

P.S. @JamesMontemagno , sorry to bother you, if you can look as well in your busy schedule.

Regards,
N Baua

Best Answer

  • N_BauaN_Baua IN ✭✭✭✭✭
    edited June 2017 Accepted Answer

    Hi Guys,

    This is weird, however it worked.
    I had to scrap my project, recreate a new project, update it with all the updates on Xamarin plus Nugets, I had.
    Compile and test-run the updated blank welcome to Xamarin app to confirm everything is fine.
    Add the Mediaplug-in and test its working (I do not see its a issue with plug-in anymore)
    When it worked finally, Add all the Views/ViewModels again so I can re-play the Xamarin games of glitches.

    Now for me, I've created a new strategy,
    Do not rely on your dev Environment commits, build locally and whatever is working keep a extra backup of that.
    Now every time, if anything is working I am keeping a RAR of my entire project, which saves lot of time which I use to waste on figuring out last few weeks. Now if anything goes wrong I just delete everything, UnRar the last backup and start-over, which also opens my way for trying new alternatives, if any. This might not sound right approach to many, however this is what I am.

    Hope Xamarin (Microsoft actually) plays nicely, in coming future.
    Thanks @JamesMontemagno for your contribution towards XF. Keep making great stuff, man.

    Regards,
    N Baua

Answers

  • MizanurRahman.0834MizanurRahman.0834 USMember ✭✭

    You have to add CAMERA permission in your Manifest file as you want to capture photo.

    Foe the file operation you have to add External Storage Read & Write permission in your Manifest file

  • MizanurRahman.0834MizanurRahman.0834 USMember ✭✭

    @MizanurRahman.0834 said:
    You have to add CAMERA permission in your Manifest file as you want to capture photo.

    For the file operation you have to add External Storage Read & Write permission in your Manifest file

  • N_BauaN_Baua INMember ✭✭✭✭✭
    edited June 2017

    @MizanurRahman.0834 said:
    You have to add CAMERA permission in your Manifest file as you want to capture photo.

    Thanks buddy,

    I have had the CAMERA permission added, the image above was saved little earlier, However the permission is not the issue yet, I checked the code later with the CAMERA and WRITE_EXTERNAL_STORAGE permissions after that and the problem still persist.

    I didn't noticed that the screenshot taken was little earlier.

    My current menifest file looks as under:

    .<?xml version="1.0" encoding="utf-8"?>

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="Discoverability.Droid">
    <uses-sdk android:minSdkVersion="19" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <application android:label="Discoverability.Droid" android:theme="@style/MyTheme" android:icon="@drawable/icon">
    <provider android:name="android.support.v4.content.FileProvider" android:authorities="Discoverability.Droid.fileprovider" android:exported="false" android:grantUriPermissions="true">
    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
    </provider>
    </application>
    </manifest>

    Thanks for your input though.

  • N_BauaN_Baua INMember ✭✭✭✭✭
    edited June 2017 Accepted Answer

    Hi Guys,

    This is weird, however it worked.
    I had to scrap my project, recreate a new project, update it with all the updates on Xamarin plus Nugets, I had.
    Compile and test-run the updated blank welcome to Xamarin app to confirm everything is fine.
    Add the Mediaplug-in and test its working (I do not see its a issue with plug-in anymore)
    When it worked finally, Add all the Views/ViewModels again so I can re-play the Xamarin games of glitches.

    Now for me, I've created a new strategy,
    Do not rely on your dev Environment commits, build locally and whatever is working keep a extra backup of that.
    Now every time, if anything is working I am keeping a RAR of my entire project, which saves lot of time which I use to waste on figuring out last few weeks. Now if anything goes wrong I just delete everything, UnRar the last backup and start-over, which also opens my way for trying new alternatives, if any. This might not sound right approach to many, however this is what I am.

    Hope Xamarin (Microsoft actually) plays nicely, in coming future.
    Thanks @JamesMontemagno for your contribution towards XF. Keep making great stuff, man.

    Regards,
    N Baua

  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    It's simple don't add permissions because I add them for you as I documented. If you add camera manually then you need to check for it, but it isn't required, so don't add it.
Sign In or Register to comment.