Android Question [RESOLVED] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for ....

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hello

With the looming SDK 34 target approaching do we have any idea when B4A will be supporting the SDK 34 standard requirements. Our flagship app does not run when SDK 34 is set in the manifest file.

There are a number of failures generated, the title being one of them.

Regards

John.
 

DonManfred

Expert
Licensed User
Longtime User
Hiding all information is a good idea not to get help.
No code, no manifest, no full error. Hard to help here.

You already should know but check this thread
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hiding all information is a good idea not to get help.
No code, no manifest, no full error. Hard to help here.

You already should know but check this thread
Not very helpful Don, expected more from you, and BTW sarcasm is the lowsest form of wit. My question was when SDK 34 support is availble. The errors are actually irrelevant as currently SDK 34 is not supported. Please refrain from posting further on this thread if you have nothing constructive to contribute.

 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Not sure if the release will cover all the new changes to support SDK 34, but Erel is working on it


It requires an update to B4A. I will release it later this week
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
Not sure if the release will cover all the new changes to support SDK 34, but Erel is working on it

thanks
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
as has been pointed out, erel is working on sdk34. there was a recent post by him. he recommended we try with it. what he didn't specify - but which i inferred - was that we should report errors. you should report them in detail. others are doing it. his own testing may not discover the errors you are experiencing but not detailing.
something that you experience might relate to something that affects me. i wouldn't mind knowing it. isolate the errors, cobble a routine together that shows them and upload the code. erel will spot the post
 
Last edited:
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
This is my main background service

B4X:
07/16/2024 15:32:30.241 - Atlas SOS - svc_service::Service_Create::error - android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14900)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3005)
    at android.os.Binder.execTransactInternal(Binder.java:1392)
    at android.os.Binder.execTransact(Binder.java:1299)
** Service (svc_service) Start **
07/16/2024 15:32:30.243 - Atlas SOS - svc_service::Service_Start
07/16/2024 15:32:30.243 - Atlas SOS - svc_service::check_terminate
07/16/2024 15:32:30.244 - Atlas SOS - svc_service::CreateNotification::Atlas SOS, You are Lone Working
07/16/2024 15:32:30.254 - Atlas SOS - svc_service::Service_Start::error - android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{c706a2d 26526:com.is.vitllinkSOS/u0a343} targetSDK=34
** Service (svc_service) Destroy **
07/16/2024 15:32:30.261 - Atlas SOS - svc_service::Service_Destroy
07/16/2024 15:32:30.292 - Atlas SOS - mod_functions::is_app_installed::com.islesystems.sosvr not installed.
07/16/2024 15:32:30.294 - Atlas SOS - svc_service::Service_Destroy, error #2 - java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.release()' on a null object reference
 
Last edited:
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
This is the manifest:

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: http://www.basic4ppc.com/forum/showthread.php?p=78136

' // 2022.05.17 - EX710SYSTEM only supports upto SDK 29
#if EX710SYSTEM
    AddManifestText(
     <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
     <supports-screens android:largeScreens="true"
         android:normalScreens="true"
         android:smallScreens="true"
        android:anyDensity="true"/>)
#else if PLAYSTORE
    AddManifestText(
         <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="34"/>
         <supports-screens android:largeScreens="true"
             android:normalScreens="true"
             android:smallScreens="true"
            android:anyDensity="true"/>)

#else
    AddManifestText(
         <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="34"/>
         <supports-screens android:largeScreens="true"
             android:normalScreens="true"
             android:smallScreens="true"
            android:anyDensity="true"/>)

#End if

' // Mark as SYSTEM APP
#if PLATFORM
    SetManifestAttribute(android:sharedUserId, "android.uid.system")
    ' // https://developer.android.com/guide/topics/manifest/application-element#persistent       
#End if


' // 2023.09.19 -  android:required="false" implemented to allow dumb devices install the app from the playstore
' // https://developer.android.com/guide/topics/manifest/uses-feature-element
' // https://developer.android.com/guide/topics/manifest/uses-feature-element#hw-features
AddManifestText(<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.location.gps" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>)

' // APPLICATION
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
#if WATCH
    SetApplicationAttribute(android:persistent, "True")
#end if

' // ACTIVITIES
SetActivityAttribute(main, android:launchMode, "singleTask")
SetActivityAttribute(main, android:clearTaskOnLaunch, "true")
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(tpa_create,android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(tpa_running,android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(Settings, android:screenOrientation, "unspecified")
SetActivityAttribute(NewAppAvailable, android:theme, "@android:style/Theme.Translucent.NoTitleBar")

' // SERVICES
SetServiceAttribute(svc_ble, android:foregroundServiceType, "location")
SetServiceAttribute(svc_itag, android:foregroundServiceType, "location")
SetServiceAttribute(svc_gps, android:foregroundServiceType, "location")

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

AddApplicationText(
                    <meta-data android:name="app_key_sos_data"
                               android:value="******************************************************************" />       
                                      
                    <meta-data android:name="app_key_sos_intent"
                               android:value="com.is.vitllinkSOS" />       
                                                 
                    <meta-data android:name="app_key_sos_priority"
                                android:value="55" />           

                    <receiver android:name=".svc_intents$svc_intents_BR"
                              android:exported="true" >
                              <intent-filter>
                                      <action android:name="com.sonim.intent.action.SOS_KEY_DOWN" />
                                      <action android:name="com.sonim.intent.action.SOS_KEY_UP" />
                              </intent-filter>
                    </receiver>
                )
'' // Needed for SSL error fix
'AddApplicationText(
'                   <meta-data android:name="com.google.android.gms.version"
'                    android:value="@integer/google_play_services_version"/>
'                )

CreateResource(values, colors.xml,
                <resources>
                    <color name="actionbar">#ffC8001F</color>
                       <color name="statusbar">#ffC8001F</color>
                       <color name="navigationBar">#ffC8001F</color>
                </resources>
                )
CreateResource(values, themes.xml,
                <resources>
                    <style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                        <item name="android:statusBarColor">@color/navigationBar</item>
                        <item name="android:navigationBarColor">@color/navigationBar</item>
                        <item name="windowNoTitle">true</item>
                        <item name="windowActionBar">false</item>
                        <item name="windowActionModeOverlay">true</item>       
                    </style>   
                </resources>
                )

' // 2023.07.10 - required for file handling - APK installs

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)
#if not(PLAYSTORE)
AddManifestText(<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />
)   
    AddPermission(android.permission.REQUEST_INSTALL_PACKAGES)
#end if

#if not(PLATFORM) or not(EX710SYSTEM) or not(S10SYSTEM)
    ' // vitllink SOS hash key - Sonim Only
    AddManifestText(<meta-data android:name="app_key_sos_data" android:value="4ac9e6c316effb7be10a791055ef6c4c348b0ff76c3f51ede05f60e8a0896a90" />)
    AddManifestText(<meta-data android:name="app_key_sos_intent" android:value="com.is.vitllinkSOS" />)       
    AddManifestText(<meta-data android:name="app_key_sos_priority" android:value="55" />)
    ' // ECOM : https://support.ecom-ex.com/ecomfaq/item?id=1125&catid=303
    AddApplicationText(
    <meta-data android:name="ecom.device.key" android:value="alert" />
    <receiver
        android:name=".svc_intents$svc_intents_BR"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action android:name="com.ecom.intent.action.SOS_BUTTON_DOWN" />
            <action android:name="com.ecom.intent.action.SOS_BUTTON_UP" />      
        </intent-filter>
    </receiver>
    )
#end if

' // 2023.07.24 - enable checking of installed apps
AddManifestText(
    <queries>
        <package android:name="com.islesystems.launcher"/>
        <package android:name="com.islesystems.pushtotalk"/>
        <package android:name="com.islesystems.hello"/>       
        <package android:name="com.islesystems.criticalmessenger"/>       
        <package android:name="com.islesystems.sosvr"/>       
        <package android:name="com.android.vending"/>                       
    </queries>
    )
   


' // Overlay permissions
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
' // Location permissions
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_COARSE_UPDATES)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
' // net
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
' // bt
AddPermission(android.permission.BLUETOOTH)
AddPermission(android.permission.BLUETOOTH_SCAN)
AddPermission(android.permission.BLUETOOTH_CONNECT)
AddPermission(android.permission.BLUETOOTH_ADMIN)

AddPermission(android.permission.CAMERA)
AddPermission(android.permission.CHANGE_NETWORK_STATE)
AddPermission(android.permission.CHANGE_WIFI_STATE)
AddPermission(android.permission.FLASHLIGHT)
AddPermission(android.permission.INTERNET)

AddPermission(android.permission.READ_PHONE_STATE)
AddPermission(android.permission.MODIFY_PHONE_STATE)
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)

AddPermission(android.permission.RECEIVE_BOOT_COMPLETED)
AddPermission(android.permission.UPDATE_DEVICE_STATS)
AddPermission(android.permission.VIBRATE)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(android.permission.SCHEDULE_EXACT_ALARM)
' // SMS
' // https://legalitgroup.com/en/sms-call-log-permissions-receive-approval-from-google-play-for-sensitive-permissions/
AddPermission(android.permission.SEND_SMS)

#if not(PLAYSTORE)   
    ' // calls
    AddPermission(android.permission.CALL_PHONE)
    AddPermission(android.permission.PROCESS_OUTGOING_CALLS)   
    AddPermission(android.permission.ANSWER_PHONE_CALLS)
    ' // SMS
    AddPermission(android.permission.RECEIVE_SMS)
    AddReceiverText(svc_sms_interceptor,
                    <intent-filter android:priority="2147483647">
                    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
                    </intent-filter>)
#end if
' // Call
#if PLATFORM
    AddPermission(android.permission.CALL_PRIVILEGED)
#end if

AddPermission(android.permission.CALL_PHONE)
AddPermission(android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)


' // 2019.10.21 - Allow home to reguest pincode
AddActivityText(svc_retrievepin, <intent-filter>
   <action android:name="com.is.vitllinkSOS.PINCODE" />
   <category android:name="android.intent.category.DEFAULT" />
</intent-filter>)

AddActivityText(svc_app_running, <intent-filter>
   <action android:name="com.islesystems.APP_RUNNING" />
   <category android:name="android.intent.category.DEFAULT" />
</intent-filter>)



AddReceiverText(svc_shutdown, <intent-filter> <action android:name="android.intent.action.ACTION_SHUTDOWN" /></intent-filter>)
' // intents from ToughShield Smartphone
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.BrighterWirelessMain.Main.SOSDown"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.BrighterWirelessMain.Main.SOSUp"/></intent-filter>)
' // Toughshield R500PLUS
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.Toughshield.Main.SOSDown"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.Toughshield.Main.SOSUp"/></intent-filter>)
' // MX2
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.ENTER_ONEKEYSOS"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.EXIT_ONEKEYSOS"/></intent-filter>)
' // CHINA PHONE
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.android.action.F3_SOS"/></intent-filter>)   

' // V710
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_DOWN_131"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_UP_131"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_DOWN_132"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_UP_132"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_DOWN_133"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_UP_133"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_DOWN_134"/></intent-filter>)       
AddReceiverText(svc_intents, <intent-filter> <action android:name="shmaker.android.intent.action.KEYEVENT_UP_134"/></intent-filter>)       
   
' // F22F25F887
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.SOS.now"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.sos.down"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.sos.up"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.sos"/></intent-filter>)
' // 2023.03.31
'AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.sos_ticket"/></intent-filter>)

' // M31 - Android 10
AddReceiverText(br_receiver, <intent-filter> <action android:name="com.android.intent.SOS.down"/></intent-filter>)           
AddReceiverText(br_receiver, <intent-filter> <action android:name="com.android.intent.SOS.up"/></intent-filter>)
AddReceiverText(br_receiver, <intent-filter> <action android:name="android.intent.action.SOS.up"/></intent-filter>)
AddReceiverText(br_receiver, <intent-filter> <action android:name="android.intent.action.SOS.down"/></intent-filter>)
' // DOMI 9
AddReceiverText(br_receiver, <intent-filter> <action android:name="android.intent.action.SOS_LONG_PRESS"/></intent-filter>)

' // Generic
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.SOS_BUTTON"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.PTT.down"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.PTT.up"/></intent-filter>)
' // RugGear
AddReceiverText(svc_intents, <intent-filter> <action android:name="android.intent.action.CALL_FOR_HELP"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.tdc.callforhelp.CallForHelpService"/></intent-filter>)
' // media key down/up
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_KEYDOWN"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_KEYUP"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_HEADPLUGIN"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_HEADPLUGOUT"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_SCREENON"/></intent-filter>)
AddReceiverText(svc_intents, <intent-filter> <action android:name="vitllink.action.MEDIA_SCREENOFF"/></intent-filter>)
' // doro phone
AddReceiverText(svc_intents, <intent-filter> <action android:name="com.doro.partner.action.ASSISTANCE_BUTTON_ACTIVATED"/></intent-filter>)


CreateResource(values-v20, theme.xml,
<resources>
    <style
        name="LightTheme" parent="@android:style/Theme.Material.Light">
    </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
    <style
        name="LightTheme" parent="@android:style/Theme.Holo.Light">
    </style>
</resources>
)
CreateResourceFromFile(Macro, Core.NetworkClearText)
'End of default text.
 
Last edited:
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Sorry, I can't provide any help with the thread topic. I just wanted to mention that the first
B4X:
#else if PLAYSTORE
seems to contain identical code to the following
B4X:
#else
So either a bug or a chance for a very small simplification.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
this jumps out:
07/16/2024 15:32:30.254 - Atlas SOS - svc_service::Service_Start::error - android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c706a2d 26526:com.is.vitllinkSOS/u0a343} targetSDK=34

https://developer.android.com/about/versions/14/changes/fgs-types-required

erel just touched on this the other day. he suggested "short service" as the type, but in a different context; your app may relate to a different type.
once you have the type sorted out, you just add it to the manifest
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
this jumps out:
07/16/2024 15:32:30.254 - Atlas SOS - svc_service::Service_Start::error - android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c706a2d 26526:com.is.vitllinkSOS/u0a343} targetSDK=34

https://developer.android.com/about/versions/14/changes/fgs-types-required

erel just touched on this the other day. he suggested "short service" as the type, but in a different context; your app may relate to a different type.
once you have the type sorted out, you just add it to the manifest
I am more concerned with this:

B4X:
07/16/2024 15:32:30.241 - Atlas SOS - svc_service::Service_Create::error - android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14900)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3005)
    at android.os.Binder.execTransactInternal(Binder.java:1392)
    at android.os.Binder.execTransact(Binder.java:1299)
 
Upvote 0

Addo

Well-Known Member
Licensed User
Longtime User
I am more concerned with this:

B4X:
07/16/2024 15:32:30.241 - Atlas SOS - svc_service::Service_Create::error - android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14900)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3005)
    at android.os.Binder.execTransactInternal(Binder.java:1392)
    at android.os.Binder.execTransact(Binder.java:1299)
How do you start your service after migrating to sdk 34 ?

Btw, the error in the title is referred to similar issue of this github issues section.

 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
I am more concerned with this:

B4X:
07/16/2024 15:32:30.241 - Atlas SOS - svc_service::Service_Create::error - android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14900)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3005)
    at android.os.Binder.execTransactInternal(Binder.java:1392)
    at android.os.Binder.execTransact(Binder.java:1299)
it's caused by what i pointed out previously.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you are using the service for background playback then add this:
B4X:
SetServiceAttribute(Your_Service_Name, android:foregroundServiceType, "mediaPlayback")
AddPermission(android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK)

If not then tell us what you are using it for.

There is a specific list of acceptable usages: https://developer.android.com/about/versions/14/changes/fgs-types-required
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
The service svc_service is a long running background service that manages other services and functions of the application. I already use the FGS methods as you can see in the manifest file I already posted. svc_service handles the foregound notifcation, it does funtionality does not appear in the specific list of acceptable usages.
 
Upvote 0
Top