I am trying to set up an SMS client.
It has limited functionality - basically the app will reside on a dedicated phone - customers will read a sign saying something like "to get a free digital ticket SMS your first name to 04123123123" and react accordingly.
The app receives the SMS, extracts phone no and name and uploads an FTP job to an AWS EC2 instance that generates the ticket as an SMS back to the customer - all this backend stuff I have had working for a long time.
But I can't for the life of me get my app to receive SMSs
Attached is a minimal skeleton that illustrates my dilemma.
The Manifest is as follows:
Which is based on my reading of:
https://www.b4x.com/android/forum/t...sms-messages-in-the-background.20103/#content
https://www.b4x.com/android/forum/t...t-notification-android-4-4.37171/#post-227969
https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
The Main activity is empty.
service2 and service3 are dummies.
service1 is as follows:
When I create a release version of the app on an Android phone I can change the phone's default messaging app to it - which I believe means I have done the manifest stuff properly.
But when I SMS the phone from another phone absolutely nothing happens (I would expect "boo" in the log).
Any guidance would be gratefully accepted...
It has limited functionality - basically the app will reside on a dedicated phone - customers will read a sign saying something like "to get a free digital ticket SMS your first name to 04123123123" and react accordingly.
The app receives the SMS, extracts phone no and name and uploads an FTP job to an AWS EC2 instance that generates the ticket as an SMS back to the customer - all this backend stuff I have had working for a long time.
But I can't for the life of me get my app to receive SMSs
Attached is a minimal skeleton that illustrates my dilemma.
The Manifest is as follows:
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="16" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
'Following required to enable this app to act as default SMS app, see:
'https://www.b4x.com/android/forum/threads/intent-filters-intercepting-sms-messages-in-the-background.20103/#content
'https://www.b4x.com/android/forum/threads/intercept-sms-messages-without-notification-android-4-4.37171/#post-227969
'https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
'This allows app to directly receive incoming SMS messages
'android.permission.BROADCAST_SMS - allows an application to broadcast an SMS receipt notification
SetReceiverAttribute(service1, android:permission, "android.permission.BROADCAST_SMS")
AddReceiverText(service1, <intent-filter>
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
)
'This allows app to directly receive incoming MMS messages
'android.permission.BROADCAST_WAP_PUSH - allows an application to broadcast a WAP PUSH receipt notification
' A WAP Push message is a binary encoded XML file that can direct a mobile phone to content
' on web - used to send ringtones, wallpapers and games to mobile phones after the user has
' sent a paid SMS to a provider
SetReceiverAttribute(service2, android:permission, "android.permission.BROADCAST_WAP_PUSH")
AddReceiverText(service2, <intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
)
'This allows user to respond to incoming phone calls with an immediate text message using app
'android.permission.SEND_RESPOND_VIA_MESSAGE - allows an application (Phone) to send a request to other applications
' to handle respond-via-message action during incoming calls
SetServiceAttribute(service3, android:permission, "android.permission.SEND_RESPOND_VIA_MESSAGE")
SetServiceAttribute(service3, android:exported, "true")
AddServiceText(service3, <intent-filter>
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
)
'This allows app to receive intents from other apps that want to deliver a message
AddActivityText(main,
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
)
https://www.b4x.com/android/forum/t...sms-messages-in-the-background.20103/#content
https://www.b4x.com/android/forum/t...t-notification-android-4-4.37171/#post-227969
https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
The Main activity is empty.
service2 and service3 are dummies.
service1 is as follows:
B4X:
'************************************************************************************
'************************************************************************************
'************************************************************************************
'
'This service provides a static broadcast receiver that will be started each time an
'SMS mssage arrives
'See:
'https://www.b4x.com/android/forum/threads/intent-filters-intercepting-sms-messages-in-the-background.20103/#content
'https://www.b4x.com/android/forum/threads/intercept-sms-messages-without-notification-android-4-4.37171/#post-227969
'https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
'
'************************************************************************************
'************************************************************************************
'************************************************************************************
#Region Service Attributes
' #StartAtBoot: False
' #ExcludeFromLibrary: True
#End Region
Sub Process_Globals
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("boo")
Service.StopAutomaticForeground
End Sub
Sub Service_Destroy
End Sub
When I create a release version of the app on an Android phone I can change the phone's default messaging app to it - which I believe means I have done the manifest stuff properly.
But when I SMS the phone from another phone absolutely nothing happens (I would expect "boo" in the log).
Any guidance would be gratefully accepted...