Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Manifest's android:exported="false" prevents app from running on device

Good day,

In my simple Andorid app which is really just a webview app, I added android:exported="false" in Android Manifest to avoid the Exported service without permissions warning / vulnerability. However when I run it on my device it would give App is not installed error, unless I change it to android:exported="true", then the app would launch fine on my device.

I then tried to add a permission tag as follows to avoid the "Exported service without permissions" warning but the app would not run again. What would be best to have the app running correctly? I don't really need to export any service. The internet permissions is for some annotation links in my app which would open in an external browser.

Sorry if I'm missing something basic as I'm new to Android development, thanks for any pointers.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"   
package=com.mymundane.app">
<uses-permission android:name="android.permission.INTERNET" />
<permission android:name=com.mymundane.app.mypermission" 
  android:label="mypermission" android:protectionLevel="signature">
</permission>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label=com.mymundane.app"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:fullBackupContent="@xml/backup_descriptor">
    <activity android:name=com.mymundane.app.MainActivity" 
        android:exported="true"  android:screenOrientation="portrait" 
         android:permission=com.mymundane.app.mypermission">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>
like image 412
Hofuzz Avatar asked Mar 25 '18 00:03

Hofuzz


People also ask

What does Android exported false mean?

The android:exported="false" value indicates that our provider is not to be exported, meaning that by default, other apps have no ability to access our provider's content.

How do I get permission off Android manifest file?

The simple way to remove this type of permission, is by deleting its xml code line from the original Android Manifest file in android/app/src/main .

What is Android manifest xml file and why do you need this?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is an Android manifest and what is it for?

The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app's package name that helps the Android SDK while building the app.


1 Answers

The "exported" attribute describes whether or not someone else can be allowed to use it.

So if you have "exported=false" on an Activity, no other app, or even the Android system itself, can launch it. Only you can do that, from inside your own application.

So settings "exported=false" on the Activity marked as the LAUNCHER Activity would basically tell the system that it cant launch your application, ever.

As for the error you mentioned, i don't see any services in your manifest? Where is that warning shown for you?

like image 197
Moonbloom Avatar answered Sep 22 '22 08:09

Moonbloom