Android Question Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be

victormedranop

Well-Known Member
Licensed User
Longtime User
I dont understand what is happening !!!!, is an working apk add just need to add sip support, and got his error , try with a lote of phones but no luck,


Logger connected to: Xiaomi 2201116SG
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
*** Receiver (httputils2service) Receive (first time) ***
** Activity (main) Create (first time) **
main_activity_create (java line: 372)
java.lang.IllegalArgumentException: net.nowyouseeme.locateME: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:404)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:674)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:661)
at anywheresoftware.b4a.objects.SIP.Register(SIP.java:168)
at net.nowyouseeme.locateME.main._activity_create(main.java:372)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at net.nowyouseeme.locateME.main.afterFirstLayout(main.java:105)
at net.nowyouseeme.locateME.main.access$000(main.java:17)
at net.nowyouseeme.locateME.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8503)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
*** Service (starter) Create ***
** Service (starter) Start **
*** Receiver (httputils2service) Receive (first time) ***
** Activity (main) Create (first time) **
main_activity_create (java line: 372)
java.lang.IllegalArgumentException: net.nowyouseeme.locateME: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

at android.app.PendingIntent.checkFlags(PendingIntent.java:404)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:674)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:661)
at anywheresoftware.b4a.objects.SIP.Register(SIP.java:168)
at net.nowyouseeme.locateME.main._activity_create(main.java:372)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at net.nowyouseeme.locateME.main.afterFirstLayout(main.java:105)
at net.nowyouseeme.locateME.main.access$000(main.java:17)
at net.nowyouseeme.locateME.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8503)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
*** Service (starter) Create ***
** Service (starter) Start **
*** Receiver (httputils2service) Receive (first time) ***
** Activity (main) Create (first time) **
(IllegalArgumentException) java.lang.IllegalArgumentException: net.nowyouseeme.locateME: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
** Activity (main) Resume **
Network WIFI connected
true false
*** Service (tracker) Create ***
{"devid":"3ba1c16bb0f81fc5","bateria":0,"latitud":0,"longitud":0,"speed":0,"apkver":25,"rc":0,"alarm":0,"internet":10,"rssi":0,"product":"","manufacturer":"","model":""}
1725737603009 http://grilletes.gmtrd.net:6055/postdata
** Service (tracker) Start **
{"devid":"3ba1c16bb0f81fc5","bateria":0,"latitud":0,"longitud":0,"speed":0,"apkver":25,"rc":0,"alarm":0,"internet":10,"rssi":0,"product":"","manufacturer":"","model":""}
1725737603015 http://grilletes.gmtrd.net:6055/postdata
{"devid":"3ba1c16bb0f81fc5","bateria":0,"latitud":0,"longitud":0,"speed":0,"apkver":25,"rc":0,"alarm":0,"internet":10,"rssi":0,"product":"","manufacturer":"","model":""}
1725737603028 http://grilletes.gmtrd.net:6055/postdata
Network WIFI connected
Network WIFI connected
Network WIFI connected
{"Nombre":"alexis medina","Caso":"vtf-5544","Bracelete":"Rf11090","Mac":"00:00:00:00:00:00","Enable":"false","UUID":"0000XXXX-0000-1000-8000-00805f9b34fb"}
bracelete functions disabled
*** Service (uploadsdatas) Create ***
** Service (uploadsdatas) Start **
{"devid":"3ba1c16bb0f81fc5","bateria":53,"latitud":0,"longitud":0,"speed":0,"apkver":25,"rc":0,"alarm":0,"internet":10,"rssi":0,"product":"","manufacturer":"","model":""}
Network WIFI connected
{"ID":0,"DeviceID":"","Comando":"","Atributos":"","Estatus":"","Creado_en":""}
{"ID":0,"DeviceID":"","Comando":"","Atributos":"","Estatus":"","Creado_en":""}
{"ID":0,"DeviceID":"","Comando":"","Atributos":"","Estatus":"","Creado_en":""}
 

victormedranop

Well-Known Member
Licensed User
Longtime User
i found a older sample version and works on my redmi 8, but if i change to sdk 34 give the same error.
i just need to get sip working . thanks

victor
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
there is a pendingintent whose flags need to be or'd with flag_immutable (as recommended by
google). the sip library has the flag hardcoded to a different setting. in addition the
value used is a hardcoded constant value, so you have no access to a variable that might be modifiable
with reflection. i could have misread the sip library, but i do have some experience using telephony,
and i've seen where the flag is (normally) set. in the library snippet below, where you see the number
2, that is a flag. that would be where flag_immutable is set:
B4X:
   PendingIntent pi = PendingIntent.getBroadcast((Context)BA.applicationContext, 0, in, 2);
the value for flag_immutable (if you were using constants) is 0x04000000

i don't think it can be addressed in the manifest. my thinking is the sip library has not been
updated to reflect this requirement. with luck, erel will see this thread and let us have his
thoughts. if i've messed up here, i apologize.
 
Upvote 0

victormedranop

Well-Known Member
Licensed User
Longtime User
using this code
B4X:
LogColor("enable Sip",Colors.Green)
    LogColor("Sip.IsInitialized "&Sip.IsInitialized,Colors.green)
    Try
        If Sip.IsInitialized = False Then
            If Sip.IsSipSupported = False Or Sip.IsVoipSupported = False Then
                Log("Not supported.")
                ToastMessageShow("SIP not supported.", True)
            Else
                Try
                    Sip.Initialize2("SIP", "sip:[email protected]", "4webrEtHupHewu4")
                    Sip.Register
                Catch
                    Log(LastException.Message)
                End Try
            End If
        End If
    Catch
        Log("AQUI SIP -> "&LastException.Message)
    End Try
    [code]

always got this error

enable Sip
Sip.IsInitialized false
java.lang.Exception
java.lang.Exception


question the sip library 1.02 is open source , can a get the code ?
i try this on a redmi 5G , then try redmi 8 and works on redmi 8. i will tru in other models.

Not Working
{"devid":"3ba1c16bb0f81fc5","bateria":95,"latitud":0,"longitud":0,"speed":0,"apkver":45,"rc":0,"alarm":0,"internet":10,"rssi":0,"product":"veux_global","manufacturer":"Xiaomi","model":"2201116SG"}
 
Last edited:
Upvote 0
Top