Direct photo taking method of the application only works on some mobile phones

Asked

Viewed 221 times

1

I have a problem in my apk that allows the user to take a photo straight from the application, however, in some cell phones give error and closes the app. Here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.diego.tecnologiadanet">

    <uses-permission android:name="ANDROID.PERMISSION.CALL_PHONE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />


    <supports-screens
        android:resizeable="true"
        android:smallScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:normalScreens="true"
        android:anyDensity="true"/>

        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/Theme.MyTheme">


        <activity
            android:name=".Splash"
            android:label="APP">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".MainActivity"
            android:label="APP">
        </activity>

        <activity
            android:name=".SecondActivity"
            android:label="@string/title_activity_second"></activity>

        <activity
            android:name=".CarActivity"
            android:label="@string/title_activity_car"></activity>

    </application>
</manifest>

How to fix this?

  • You can add the error that appears in the logcat?

  • Bro I’m not emulating straight on cel, I generated apk and some people who are using apk are reporting this problem.

  • 3

    Without the detail of the error, only with your manifesto, it is very difficult to help you find the problem!

  • 1

    Difficult without error logging, use Google Analytics to help you with this, every exception you can report to it. https://developers.google.com/analytics/devguides/collection/android/v4/? hl=en#configurao-do-projeto

  • Post java code. Which version of Android devices gives error?

  • 1
Show 1 more comment

1 answer

2


Without the error description it is very difficult to understand the problem and suggest a solution, but still, come on.

What I imagine is happening, since it’s only on some phones, is that these cell phones are running the version of Android Marshmallow and not enabled to use the camera directly from the App.

This happens because in this version of Android has been introduced a new form of permissions control and how these permissions are requested from the user. For your App to work as expected, you need to adapt it to this new way of managing and asking for permission.

I suggest you take a look in this article from the official Android website for developers and also this subject of Androidcentral

  • You are "kicking" an answer that, even though the premise is right, does not answer the question (just a link). Notice that I had already asked the AP about the Android version.

  • @Actually, I only came to that conclusion because I had trouble with that kind of permission this morning. Interestingly, the case was very similar. So, it’s not really a kick but based on the scenario he described. Mainly because the necessary permission to use the camera is there, but we still do not know if the App is prepared for this type of "permission".

  • I also thought that was the problem (hence my comment asking), but it could be another. My comment on your reply is mainly the result of the solution being presented with only one link, the rest could have been said in a comment :).

  • 1

    Good @ramaral ;) .

  • Uilque has been reading about it already.. And I’m guessing this is the problem. The mobile phone and the version Marsh.. And on other phones with previous versions work. Tomorrow I will apply this permission medium. Obgdo for help

  • Carlos, this is because in the versions prior to M, user already gives all permissions on installation. :)

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.