Android Question Send and receive SMS

sultan87

Active Member
Licensed User
Longtime User
hello,
I wrote an app that works with sending sms and waiting for the answer
this app works fine on my samsung android 4.2.2 ACE3
sent and received messages are not sent to the base messaging.
I download this app on a samsung android s4 lolipop, messages sent and received are sent to basic messaging
Why?
Attached is a single from the app
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

    Dim Sms As PhoneSms
   
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim SI_FUN_know As SmsInterceptor

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

    SI_FUN_know.Initialize2("SI_FUN_know", 999)
   
    Sms.Send("+33xxxxx","FUN:A")
   
    Msgbox("SMS FUN:A envoyé sur le numéro xxxxxx" ,"Suivi")
   
End Sub

Sub Activity_Resume


   
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub SI_FUN_know_MessageReceived (From As String, Body As String) As Boolean
   
' SMS TEMP reçu

    If From.Contains("768265746") = False Or Body.contains("Funzionamento") = False Then
        Return False
    End If
   
    Msgbox("Message reçu du Comelec, Téléphone " & From  & Chr(10) & "Contenu " & Body,"Suivi")
   
    Activity.Finish
   
    Return True

End Sub

best regards
 

eurojam

Well-Known Member
Licensed User
Longtime User
you can try to give the interceptor a higher priority:
B4X:
Dim SIC As SmsInterceptor
SIC.Initialize2("SIC", 2147483647)
'set the interceptor to the highest priority.
'May be there will be clients which have a higher priority.
'Tested with google hangouts works
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Starting from 4.4 KitKat your app must be declared as default messaging application and take place of the stock client.
You will find tons of posts here that talk about this (search for "SMS Kitkat")
 
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
Starting from 4.4 KitKat your app must be declared as default messaging application and take place of the stock client.
You will find tons of posts here that talk about this (search for "SMS Kitkat")
Hello,
thank's for your response (eurojam and marcick)
having changed the priority, my app intercept messages
but sent messages are always stored in the default messaging
and intercepted messages relating to the app, despite the return true
how to avoid this?
how declared my appli default messaging temporarily
best regards
 
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
It's not a couple of code rows and it's difficult for me to help you as you wish.
I had days of brainstorming and headache two years ago about this stuff and the solution is not so easy to implement.
I found that thread, if you have patience to read it you can arrive somewhere ....

https://www.b4x.com/android/forum/t...t-notification-android-4-4.37171/#post-227969

The real problems is, once you have made your app as default SMS application modifying the manifest, allow the user to send and read normal SMS for its normal needings.
That means you have to write a graphic interface for compose and read SMS.
Also thinking to switch continuously from the stock client to your client and viceversa is an awful solution....

Sorry I can't help you more ....
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…