开发者

SMS gateway how to program android app [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I want to make a SMS gateway app, that polls my website and checks if there are messages to send in the queue, and if there is, the app will send it to the destination number.

There should also be a callback function, where I will post information about the message, what android did exactly with it.

I thought first to create a service and do the poll check over wifi to the website, but refering to website "http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/" it is not possible to create a service that will run forever.

What should I take in mind b开发者_StackOverflow社区y make this app possible. There a lot of tricks, like wakelocks, startforeground etc, but still the service will not run forever.

Thanks.

Shafqat


For sending sms messages: http://developer.android.com/reference/android/telephony/SmsManager.html

For checking/polling for new messages, probably the best way is using push messages. Since 2.2 this can be done with Cloud To Device Messaging: http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html and http://blog.boxedice.com/2010/10/07/android-push-notifications-tutorial/

That should work in the background, in the same way that gmail checks his mail (for example)


Instead of polling or long running requests you should use GCM (Google Cloud Messaging) ... like what this app/lib does: http://netbizltd.com/wp/budget-sms-gateway/


As that post recommends, you should use AlarmManager to handle periodic polling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜