`
happyanyday
  • 浏览: 81744 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

PUSH

    博客分类:
  • J2ME
阅读更多
1.WAP更像因特网,是一个内容丰富的站点,用户如何找到自己喜欢的站点,如何在一个站点中找到自己喜欢的业务,往往需要花上很长的一段时间。而WAP PUSH可以将某一站点或某一业务的链接通过短信发送到支持WAP PUSH功能的手机上,这样您只需要阅读这条短信,打开短信中的链接,就可以直接访问业务了。因此,WAP PUSH实现了短信和WAP业务的结合,节省了您寻找业务的时间,方便您直接找到并使用自己喜欢的业务。
<!---->

 哪些手机支持WAP PUSH?

  目前支持这一功能的手机有:诺基亚、索尼爱立信、西门子的全部GPRS手机,摩托罗拉一般都支持。详细情况可以咨询您的手机制造商。

  如果您的手机不支持WAP PUSH,将会收到一条内容为乱码的信息。

2.

 

我解决了这个问题,但可能运营商的网关有很大关系,不一定到处通用,大家可以试试,在北京是可以的。
有些相关的文档可以参考:
http://www.cnblogs.com/sumtec/archiv.../19/94110.aspx

/*
*以下仅是示例代码,仅供参考。
*/

//aUrl就是PUSH消息所包含的URL,注意该URL不包含"http://";
//aPrompt就是UTF-8编码的PUSH提示消息。
void AssembleWapPushMessage(const TDesC8& aUrl, const TDesC8& aPrompt)
{
HBufC8* wapPushMsg = HBufC8::NewLC(1024);

TPtr8 msgPtr = wapPushMsg->Des();
msgPtr.Zero();

//组装WAP PUSH消息
//PUD
msgPtr.Append(0x29);
msgPtr.Append(0x06);
msgPtr.Append(0x06);
msgPtr.Append(0x03);
msgPtr.Append(0xAE);
msgPtr.Append(0x81);
msgPtr.Append(0xEA);
msgPtr.Append(0x8D);
msgPtr.Append(0xCA);

//WAP PUSH的内容字段
msgPtr.Append(0x02);
msgPtr.Append(0x05);
msgPtr.Append(0x6A);
msgPtr.Append(0x00);
msgPtr.Append(0x45);
msgPtr.Append(0xC6);
msgPtr.Append(0x0C);
msgPtr.Append(0x03);

//添加URL
msgPtr.Append(aUrl);
msgPtr.Append(0x00);
msgPtr.Append(0x01);
msgPtr.Append(0x03);

//添加WAP PUSH消息体
msgPtr.Append(aPrompt);
msgPtr.Append(0x00);
msgPtr.Append(0x01);
msgPtr.Append(0x01);

//提交发送请求
SendWapPushSmsL(_L("13800138000"), msgPtr);

CleanupStack::PopAndDestroy(wapPushMsg);
}


TBool SendWapPushSmsL(const TDesC& aAddress, const TDesC8& aMessage)
{
//创建消息
CreateWapPushMessageL(aAddress, aMessage);
// Validate it before sending
if(ValidateCreatedSMS())
{
// Now send
SendSMS2L();
return ETrue;
}
else
{
return EFalse;
}
}

void CreateWapPushMessageL(const TDesC& aAddress, const TDesC8& aMessage)
{
// Set SMS parameters
TMsvEntry indexEntry;
indexEntry.iDate.HomeTime();

CSmsSettings& serviceSettings = iSmsMtm->ServiceSettings();

indexEntry.SetInPreparation(ETrue);
// This is an SMS message
indexEntry.iMtm = KUidMsgTypeSMS;
indexEntry.iType = KUidMsvMessageEntry;
//Gets the ID of the current SMS service.
indexEntry.iServiceId = iSmsMtm->ServiceId();

// Create entry to drafts
iSmsMtm->SwitchCurrentEntryL(KMsvDraftEntryId);

// Creates a new child entry owned by the context synchronously.
iSmsMtm->Entry().CreateL(indexEntry);

// Set the MTM's active context to the new message
iSmsId = indexEntry.Id();
iSmsMtm->SwitchCurrentEntryL(iSmsId);

// Add message body. Body is set twice because index entry keeps a copy
// of some summary information. Index entry and full stored entry
// must be in sync.
// Set the SMS message settings for the message.
CSmsHeader& header = iSmsMtm->SmsHeader();
CSmsMessage &msg = header.Message();
TSmsUserDataSettings smsSettings;
smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet8Bit);
msg.SetUserDataSettingsL(smsSettings);

CSmsPDU &pdu = msg.SmsPDU();
CSmsUserData& userData = pdu.UserData();
userData.SetBodyL(aMessage);

pdu.SetBits7To4(TSmsDataCodingScheme::ESmsDCSTextUncompressed7BitOr8Bit);
pdu.SetClass(TRUE, TSmsDataCodingScheme::ESmsClass1);
pdu.SetPIDType(TSmsProtocolIdentifier::ESmsPIDTelematicInterworking);
pdu.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet8Bit);

TBuf8<16> smsPort;
smsPort.SetLength(4);
smsPort[0] = 0x0B;
smsPort[1] = 0x84;
smsPort[2] = 0xF0;
smsPort[3] = 0x00;
userData.AddInformationElementL(CSmsInformationElement::ESmsIEIApplicationPortAddressing16Bit,smsPort);

serviceSettings.SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet8Bit);
serviceSettings.SetDelivery( ESmsDeliveryImmediately ); // to be delivered immediately
serviceSettings.SetDeliveryReport(EFalse);
header.SetSmsSettingsL( serviceSettings );// new settings

//添加收件人
iSmsMtm->AddAddresseeL(aAddress);
indexEntry.iDetails.Set(aAddress);

// Commit changes because index entry is only a local variable
iSmsMtm->Entry().ChangeL(indexEntry);

// Save full message data to the store
iSmsMtm->SaveMessageL();
}

TBool ValidateCreatedSMS()
{
TMsvPartList partsToBeChecked = KMsvMessagePartBody | KMsvMessagePartRecipient |
KMsvMessagePartOriginator | KMsvMessagePartDate;

// ValidateMessage return KErrNone if message is valid.
TMsvPartList failedParts = iSmsMtm->ValidateMessage(partsToBeChecked);

if (failedParts == KMsvMessagePartNone)
{
return ETrue;
}
else
{
return EFalse;
}
}

void SendSMS2L()
{
// Changes the entry on which later actions are performed to the entry with the
// specified TMsvId.
iSmsMtm->SwitchCurrentEntryL(iSmsId);

// Load the created message
iSmsMtm->LoadMessageL();

// Gets the current SMS service settings
CSmsSettings& serviceSettings = iSmsMtm->ServiceSettings();

// Gets the number of service centre addresses stored in this object.
const TInt numSCAddresses = serviceSettings.NumSCAddresses();

// There should always be a service center number
if (numSCAddresses > 0)
{
CSmsNumber* serviceCentreNumber = NULL;

// get the service center number
if ((serviceSettings.DefaultSC() >= 0) && (serviceSettings.DefaultSC() < numSCAddresses))
serviceCentreNumber = &(serviceSettings.SCAddress(serviceSettings.DefaultSC()));
else
serviceCentreNumber = &(serviceSettings.SCAddress(0));

iSmsMtm->SmsHeader().SetServiceCenterAddressL(serviceCentreNumber->Address());
}
else
{
// Leave if there is no service center number
User::Leave(0);
}

iSmsMtm->SaveMessageL();

// Index entry must be Updated
TMsvEntry indexEntry = iSmsMtm->Entry().Entry();
// Set in-preparation flag
indexEntry.SetInPreparation(EFalse);
// Sets the sending state
indexEntry.SetSendingState(KMsvSendStateWaiting);
iSmsMtm->Entry().ChangeL(indexEntry);

// Time to send the message
Cancel(); // prepare iMsvOper for use
iEntrySelection->Reset();
iEntrySelection->AppendL(iSmsId);

TBuf8<1> dummyParam;
// There is also InvokeSyncFunctionL which is synchronous.
iMsvOper = iSmsMtm->InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy, *iEntrySelection, dummyParam, iStatus);
SetActive();
}
<!---->Reply With Quote <!---->
  #9  
<!---->Old 2007-04-02, 07:58 <!---->
<!---->
yangsy.mis yangsy.mis is offline <script type="text/javascript"> vbmenu_register("postmenu_297195", true); </script>
Registered User
 
Join Date: Mar 2007
Posts: 9
<!---->
<!----><!---->
Re: [请教]如何发wap push短信

<!----><!---->
哈哈,您所提供的代码确实实现了发送wap push短信的功能
大家用这段代码的时候,记住
include <gsmuset.h>
不然编译会通不过
<!---->
分享到:
评论
1 楼 redduke1202 2007-04-11  
发错地方了吧
怎么搞到J2me版面了?

相关推荐

    unipush 推送消息服务端接口支撑(1.0版本,免费)

    关于unipush推送消息,手机端接收消息并且展示通知栏的服务端代码资源。 适用于App消息推送,支持在线离线推送消息。适用场景多元化(只需要用户登录App时进行用户信息和手机设备id绑定的处理) 首先要引入unipush的...

    adb push不支持中文乱码的解决方案

    1.android adb push不支持中文乱码的解决方案. 2.在windows底下文件(夹)命名所采用的是GBK编码,而在Android中采用的UTF-8编码,所有使用adb 的push和pull命令时就会导致由于编码方式的不同而产生的错误,解决这一...

    考勤机push sdk 2(含demo)

    HTTP PUSH是我们基于HTTP协议自主开发的一种通信协议,以设备主动访问服务器的机制进行数据传输。主要适应环境:网络较稳定,支持TCP/IP协议,例如普遍使用的局域网、万维网等。  优点: 新数据主动上传。 有断点续...

    Android wappush讲解

    而WAP PUSH可以将某一站点或某一业务的链接通过短信发送到支 持WAP PUSH功能的手机上,这样您只需要阅读这条短信(服务信息),打开短信中的链接,就可以直接访问业务 了。因此,WAP PUSH实现了短信和WAP业务的结合,...

    Push

    Push

    关于JS数组追加数组采用push.apply的问题

     a.push.apply(a, b);以上的代码在mac的chrome下抛出了如下的异常 代码如下:Uncaught RangeError: Maximum call stack size exceeded如果把数组改为b = new Array(125623);小一个元素居然就好了,测试了一下其他...

    push推送浅析

    push推送浅析,有关push的知识,有空可以多学习学习的。

    中控智慧身份识别一体机二次开发PUSH协议文档及demo

    中控智慧身份识别一体机二次开发PUSH协议文档及demo 考勤 PUSH 通讯协议 PUSH SDK 文档版本:V3.4 日期:2018年10月 push 协议版本:V2.4.0

    【微信小程序-毕设期末大作业】k-push小程序(含后端源码).zip

    【微信小程序-毕设期末大作业】k-push小程序(含后端源码).zip 【微信小程序-毕设期末大作业】k-push小程序(含后端源码).zip 【微信小程序-毕设期末大作业】k-push小程序(含后端源码).zip 【微信小程序-毕设...

    iPhone的Push(推送通知)功能原理浅析

    Provider是指某个iPhone软件的Push服务器。 APNS 是Apple Push Notification Service(Apple Push服务器)的缩写,下文统一使用该缩写。 因 此,整个过程可以分为三个阶段,下面用大家常用的聊天客户端BeejiveIM来...

    JavaPush消息推送

    JavaPush消息推送

    Uniapp集成UniPush.rar

    这是一个uniapp 使用 Uni Push 的实例Demo,不懂得可以去我的博客找到 uniapp实现unipush推送功能 这篇文章,了解详情

    实现WAP Push业务的两种方式的比较.pdf

    WAP Push是目前移动通信领域广泛应用的业务营销途径和新业务的承栽方式。现阶段在我国实现 WAP Push的方式主要通过短信的承载方式下发Push消息到用户的终端,SP(ServiceProvider)直接将消 息发送到短信网关。然而,...

    pc端快速push文件到安卓bat

    ,Windows上快速push文件到安卓手机上的bat文件,解压文件后用记事本修改/mnt/sdcard/ebook为你想要的文件路径,然后保存运行,在命令行中输入文件名。ok就这么简单

    Android代码-Push

    To start using it, you need to have set up the Push Server. With the Push Server OK, open the file Config.java and change the addresses of your server and the GCM Sender ID: public static class ...

    ionic2 codepush热更新使用

    ionic2中使用codepush插件实现热更新功能,内含功能实现流程,插件下载以及实现代码

    uni-app 中使用uni push的demo

    1、在uni-app 中使用uni push; 2、可以实现在demo 中发送推送

    跨浏览器的桌面通知插件Push.js.zip

    Push.js,是一款跨浏览器的Javascript桌面通知插件。这个通知API允许在当下流行的浏览器上使用,像Chrome, Safari, Firefox,和IE 9 。可以推送一个通知到用户桌面。如果用户的浏览器不支持这个新的API,会回滚到使用...

Global site tag (gtag.js) - Google Analytics