Android Question android:exported once again

EduardoElias

Well-Known Member
Licensed User
Longtime User
In this particular app besides adding android:exported = true I keed receiving the message about it (developer.android.com/about/versions/12/behavior-changes-12#exported)

What am I missing?

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
    
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.

AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.bluetooth" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.accessory" android:required="true" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.host" android:required="true" />)
AddManifestText(<uses-feature android:name="android.hardware.wifi" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.GPS" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.WIFI" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.touchscreen" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />)
RemovePermission(android.permission.ACCESS_COARSE_LOCATION)
RemovePermission(android.permission.ACCESS_FINE_LOCATION)
RemovePermission(android.permission.VIBRATE)
RemovePermission(android.permission.BLUETOOTH_PRIVILEGED)
RemovePermission(android.permission.BLUETOOTH_ADMIN)

AddManifestText(<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>)


'AddActivityText(main, <intent-filter >
'        <action android:name="android.intent.action.MAIN" />
'        <category android:name="android.intent.category.HOME" />
'        <category android:name="android.intent.category.DEFAULT" />
'    </intent-filter>)   

SetActivityAttribute(main, android:directBootAware, "true")
SetActivityAttribute(main, android:exported, "true")

CreateResource(xml, device_filter.xml,
<resources>
<usb-device vendor-id="5971" product-id="51458"/>
<usb-device vendor-id="1155" product-id="22337"/>
<usb-device vendor-id="1550" product-id="2400"/>

<usb-device vendor-id="6790" product-id="29987"/> 
</resources>)

AddApplicationText(
<activity android:name="main" >
    <intent-filter>
        <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:exported="true"/>
    </intent-filter>
    
    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
</activity>)

AddApplicationText(
<receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
  android:permission="android.permission.BIND_DEVICE_ADMIN" android:exported="true">
  <meta-data android:name="android.app.device_admin"
  android:resource="@xml/device_admin" />
  <intent-filter>
  <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
  </intent-filter>
</receiver>)

CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>)
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Check the generated AndroidManifest.xml file. Look for intent-filter nodes.
This is the generated manifest.

It still causing the same error.

There are exported = true everywhere, what am i missing?

B4X:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="yashar.yTEF"
    android:versionCode="8"
    android:versionName="1.8"
    android:installLocation="internalOnly">
    
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <supports-screens android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"/>
    <uses-feature android:name="android.hardware.telephony" android:required="false"/>
    <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
    <uses-feature android:name="android.hardware.usb.accessory" android:required="true" />
    <uses-feature android:name="android.hardware.usb.host" android:required="true" />
    <uses-feature android:name="android.hardware.wifi" android:required="false" />
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />
    <uses-feature android:name="android.hardware.LOCATION" android:required="false" />
    <uses-feature android:name="android.hardware.location.GPS" android:required="false" />
    <uses-feature android:name="android.hardware.WIFI" android:required="false"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <application
        android:icon="@drawable/icon"
        android:label="yDashenBox"
        android:theme="@style/LightTheme">
        
        <activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>
        <activity android:name="main" >
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:exported="true"/>
            </intent-filter>
            
            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
        </activity>
        <receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
          android:permission="android.permission.BIND_DEVICE_ADMIN" android:exported="true">
          <meta-data android:name="android.app.device_admin"
          android:resource="@xml/device_admin" />
          <intent-filter>
          <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" android:exported="true"/>
          </intent-filter>
        </receiver>
        <activity
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".main"
            android:label="yDashenBox"
            android:screenOrientation="unspecified"
            android:exported="true"
            android:directBootAware="true">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            
        </activity>
        <service
            android:name=".starter"
            android:exported="true">
        </service>
        <receiver
            android:name=".starter$starter_BR"
            android:exported="true">
        </receiver>
        <service
            android:name=".booter"
            android:exported="true">
        </service>
        <receiver
            android:name=".booter$booter_BR"
            android:exported="true">
            <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
        <service
            android:name=".httputils2service"
            android:exported="true">
        </service>
        <receiver
            android:name=".httputils2service$httputils2service_BR"
            android:exported="true">
        </receiver>
        <service
            android:name=".newinst2"
            android:exported="true">
        </service>
        <receiver
            android:name=".newinst2$newinst2_BR"
            android:exported="true">
        </receiver>
        <service
            android:name="yashar.yBroadcastClient.ybroadcastclientservice"
            android:exported="true">
        </service>
        <receiver
            android:name="yashar.yBroadcastClient.ybroadcastclientservice$ybroadcastclientservice_BR"
            android:exported="true">
        </receiver>
    </application>
</manifest>
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I see several mistakes from a quick look:

1. You shouldn't add your own activities with AddApplicationText. You should instead use AddActivityText to add a node inside the activity.
2. The android:exported attribute is an activity/service/receiver attribute. Don't add it to the action node. Do add it to the activity.
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
I made several changes:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
   
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.

AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.bluetooth" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.accessory" android:required="true" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.host" android:required="true" />)
AddManifestText(<uses-feature android:name="android.hardware.wifi" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.GPS" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.WIFI" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.touchscreen" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />)
RemovePermission(android.permission.ACCESS_COARSE_LOCATION)
RemovePermission(android.permission.ACCESS_FINE_LOCATION)
RemovePermission(android.permission.VIBRATE)
RemovePermission(android.permission.BLUETOOTH_PRIVILEGED)
RemovePermission(android.permission.BLUETOOTH_ADMIN)

AddManifestText(<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>)


'AddActivityText(main, <intent-filter >
'        <action android:name="android.intent.action.MAIN" />
'        <category android:name="android.intent.category.HOME" />
'        <category android:name="android.intent.category.DEFAULT" />
'    </intent-filter>)  

AddActivityText(main, android:name="anywheresoftware.b4a.objects.preferenceactivity")

SetActivityAttribute(main, android:directBootAware, "true")
SetActivityAttribute(main, android:exported, "true")

CreateResource(xml, device_filter.xml,
<resources>
<usb-device vendor-id="5971" product-id="51458"/>
<usb-device vendor-id="1155" product-id="22337"/>
<usb-device vendor-id="1550" product-id="2400"/>

<usb-device vendor-id="6790" product-id="29987"/>
</resources>)

AddActivityText(main,
<intent-filter>
      <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:exported="true" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />)
       

AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
  android:permission="android.permission.BIND_DEVICE_ADMIN">
  <meta-data android:name="android.app.device_admin"
  android:resource="@xml/device_admin" />
 
  <intent-filter>
      <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" android:exported="true"/>
  </intent-filter>
</receiver>)

CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>
)

CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>)

'End of default text.


the problem persists, this is the resultant Manifest

B4X:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="yashar.yTEF"
    android:versionCode="8"
    android:versionName="1.8"
    android:installLocation="internalOnly">
   
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <supports-screens android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"/>
    <uses-feature android:name="android.hardware.telephony" android:required="false"/>
    <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
    <uses-feature android:name="android.hardware.usb.accessory" android:required="true" />
    <uses-feature android:name="android.hardware.usb.host" android:required="true" />
    <uses-feature android:name="android.hardware.wifi" android:required="false" />
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />
    <uses-feature android:name="android.hardware.LOCATION" android:required="false" />
    <uses-feature android:name="android.hardware.location.GPS" android:required="false" />
    <uses-feature android:name="android.hardware.WIFI" android:required="false"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <application
        android:icon="@drawable/icon"
        android:label="yDashenBox"
        android:theme="@style/LightTheme">
       
        <receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
          android:permission="android.permission.BIND_DEVICE_ADMIN">
          <meta-data android:name="android.app.device_admin"
          android:resource="@xml/device_admin" />
         
          <intent-filter>
              <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" android:exported="true"/>
          </intent-filter>
        </receiver>
        <activity
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".main"
            android:label="yDashenBox"
            android:screenOrientation="unspecified"
            android:exported="true"
            android:directBootAware="true">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           
            android:name="anywheresoftware.b4a.objects.preferenceactivity"
            <intent-filter>
                  <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:exported="true" />
            </intent-filter>
            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
        </activity>
        <service
            android:name=".starter"
            android:exported="true">
        </service>
        <receiver
            android:name=".starter$starter_BR"
            android:exported="true">
        </receiver>
        <service
            android:name=".booter"
            android:exported="true">
        </service>
        <receiver
            android:name=".booter$booter_BR"
            android:exported="true">
            <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
        <service
            android:name=".httputils2service"
            android:exported="true">
        </service>
        <receiver
            android:name=".httputils2service$httputils2service_BR"
            android:exported="true">
        </receiver>
        <service
            android:name=".newinst2"
            android:exported="true">
        </service>
        <receiver
            android:name=".newinst2$newinst2_BR"
            android:exported="true">
        </receiver>
        <service
            android:name="yashar.yBroadcastClient.ybroadcastclientservice"
            android:exported="true">
        </service>
        <receiver
            android:name="yashar.yBroadcastClient.ybroadcastclientservice$ybroadcastclientservice_BR"
            android:exported="true">
        </receiver>
    </application>
</manifest>

looking for further advice
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…