I am working on an application that communicates with a backend over SMS (Actually Data SMS).
Outgoing and incoming SMS works perfectly in a regular setup, however one of our users have an Android Work Profile enabled and the app is installed within the work profile.
Now the app does not receive the DATA_SMS_RECEIVED intent. I have tried to find any documentation on this but have found none. Is there anything special I need to do in order to make DATA_SMS_RECEIVED work on a work profile?
Here is the relevant manifest declaration:
<receiver android:name=".broadcastreceiver.SmsReceived" android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.DATA_SMS_RECEIVED" />
<data android:scheme="sms" />
<data android:port="1234" />
</intent-filter>
</receiver>
And here is the relevant code from the BroadcastReceiver
public class SmsReceived extends BroadcastReceiver{
private static final String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
@Override
public void onReceive(Context context, Intent intent) {
try{
if(intent.getAction().equalsIgnoreCase(DATA_SMS_RECEIVED_ACTION)){
//Code here is not executed when installed in work profile
}
}catch(Exception e){
}
}
}
Please note: this is an internal app and Androids new SMS restrictions does not apply.