Reputation: 21485
An application on Android phone (4.0.4 or newer) needs to send a notification to the server (very small one, could fit in 1024 bytes). The problem is that the network might not be available at the moment.
Usually the application would try again once the network becomes available, but the message has to arrive if the application itself gets uninstalled before that happens.
If that changes anything, my specific case requires the message to be sent when the user disables or uninstalls our device administrator application.
For now I expect this to be not possible but maybe someone can think of a solution. One possibility I can see is sending a SMS in such case but it is hard to receive it at the server end.
Upvotes: 0
Views: 979
Reputation: 21485
So the unfortunate answer is the expected one - it is not possible...
Upvotes: 1
Reputation: 28179
Can you send an SMS instead of a message to the server?
If so, then you can call
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
You'll need permission: android.permission.SEND_SMS
See SmsManager for details.
If there's no service provider connection available, the SMS will get in the sms outbox, and will be sent when a connection is restored. The user will still be able to go into his outbox and delete the message from there.
Upvotes: 0