本文整理汇总了Java中android.provider.Telephony.Sms.Intents类的典型用法代码示例。如果您正苦于以下问题:Java Intents类的具体用法?Java Intents怎么用?Java Intents使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Intents类属于android.provider.Telephony.Sms包,在下文中一共展示了Intents类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleSmsReceived
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
private void handleSmsReceived(Intent intent, int error) {
SmsMessage[] msgs = Intents.getMessagesFromIntent(intent);
String format = intent.getStringExtra("format");
Uri messageUri = insertMessage(this, msgs, error, format);
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE) || LogTag.DEBUG_SEND) {
SmsMessage sms = msgs[0];
Log.v(TAG, "handleSmsReceived" + (sms.isReplace() ? "(replace)" : "") +
" messageUri: " + messageUri +
", address: " + sms.getOriginatingAddress() +
", body: " + sms.getMessageBody());
}
if (messageUri != null) {
long threadId = MessagingNotification.getSmsThreadId(this, messageUri);
// Called off of the UI thread so ok to block.
Log.d(TAG, "handleSmsReceived messageUri: " + messageUri + " threadId: " + threadId);
MessagingNotification.blockingUpdateNewMessageIndicator(this, threadId, false);
}
}
开发者ID:slvn,项目名称:android-aosp-mms,代码行数:21,代码来源:SmsReceiverService.java
示例2: onReceive
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onReceive(Context receivedContext, Intent intent) {
if (Intents.SMS_RECEIVED_ACTION.equals(intent.getAction())) {
SnippetEvent event = new SnippetEvent(mCallbackId, SMS_RECEIVED_EVENT_NAME);
Bundle extras = intent.getExtras();
if (extras != null) {
SmsMessage[] msgs = Intents.getMessagesFromIntent(intent);
StringBuilder smsMsg = new StringBuilder();
SmsMessage sms = msgs[0];
String sender = sms.getOriginatingAddress();
event.getData().putString("OriginatingAddress", sender);
for (SmsMessage msg : msgs) {
smsMsg.append(msg.getMessageBody());
}
event.getData().putString("MessageBody", smsMsg.toString());
mEventCache.postEvent(event);
mContext.unregisterReceiver(this);
}
}
}
开发者ID:google,项目名称:mobly-bundled-snippets,代码行数:24,代码来源:SmsSnippet.java
示例3: onReceive
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
public final void onReceive(Context paramContext, Intent paramIntent)
{
if (!"android.provider.Telephony.SMS_RECEIVED".equals(paramIntent.getAction()))
{
Log.d("SmsReceiver", "Received intent with action: " + paramIntent.getAction());
return;
}
if (this.mListener == null)
{
Log.v("SmsReceiver", "No listener to handle SMS broadcasts");
return;
}
if (Build.VERSION.SDK_INT >= 19)
{
this.mListener.onSmsReceived(Telephony.Sms.Intents.getMessagesFromIntent(paramIntent));
return;
}
Object[] arrayOfObject = (Object[])paramIntent.getExtras().get("pdus");
int i = arrayOfObject.length;
SmsMessage[] arrayOfSmsMessage = new SmsMessage[i];
for (int j = 0; j < i; j++) {
arrayOfSmsMessage[j] = SmsMessage.createFromPdu((byte[])(byte[])arrayOfObject[j]);
}
this.mListener.onSmsReceived(arrayOfSmsMessage);
}
开发者ID:ChiangC,项目名称:FMTech,代码行数:26,代码来源:SmsReceiver.java
示例4: handleSmsReceived
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
private void handleSmsReceived(Intent intent, int error) {
SmsMessage[] msgs = Intents.getMessagesFromIntent(intent);
String format = intent.getStringExtra("format");
Uri messageUri = insertMessage(this, msgs, error, format);
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE) || LogTag.DEBUG_SEND) {
SmsMessage sms = msgs[0];
Log.v(TAG, "handleSmsReceived" + (sms.isReplace() ? "(replace)" : "") +
" messageUri: " + messageUri +
", address: " + sms.getOriginatingAddress() +
", body: " + sms.getMessageBody());
}
if (messageUri != null) {
long threadId = MessagingNotification.getSmsThreadId(this, messageUri);
// Called off of the UI thread so ok to block.
MessagingNotification.blockingUpdateNewMessageIndicator(this, threadId, false);
}
}
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:20,代码来源:SmsReceiverService.java
示例5: onReceive
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String action = (intent == null ? null : intent.getAction());
if (Intents.SMS_DELIVER_ACTION.equals(action) || Intents.SMS_RECEIVED_ACTION.equals(action)) {
Bundle bundle = intent.getExtras();
if (bundle == null)
Toast.makeText(context, action, Toast.LENGTH_LONG).show();
else {
Object[] pdusObj = (Object[]) bundle.get("pdus");
for (Object currentObj : pdusObj) {
SmsMessage message = SmsMessage.createFromPdu((byte[]) currentObj);
String origin = message.getDisplayOriginatingAddress();
Toast.makeText(context, action + ": " + origin, Toast.LENGTH_LONG).show();
}
}
}
}
开发者ID:M66B,项目名称:XPrivacyTester,代码行数:18,代码来源:SmsReceiver.java
示例6: waitForSms
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Rpc(description = "Wait for incoming SMS message.")
public JSONObject waitForSms() throws Throwable {
String callbackId = SMS_CALLBACK_ID_PREFIX + (++mCallbackCounter);
SmsReceiver receiver = new SmsReceiver(mContext, callbackId);
mContext.registerReceiver(receiver, new IntentFilter(Intents.SMS_RECEIVED_ACTION));
return Utils.waitForSnippetEvent(
callbackId, SMS_RECEIVED_EVENT_NAME, DEFAULT_TIMEOUT_MILLISECOND)
.toJson();
}
开发者ID:google,项目名称:mobly-bundled-snippets,代码行数:11,代码来源:SmsSnippet.java
示例7: getMessagesFromIntent
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
/**
* Retrieve any SmsMessage objects encoded in the SMS_RECEIVED intent.
*
* @param intent An intent passed by Android to the SMS_RECEIVED receiver.
* @return A list of SmsMessages. The list will be non-null but zero length if the intent lacks
* SMS content.
*/
public static List<SmsMessage> getMessagesFromIntent(Intent intent) {
List<SmsMessage> result = new ArrayList<SmsMessage>();
SmsMessage[] messages = Intents.getMessagesFromIntent(intent);
if (messages != null && messages.length >= 0) {
Collections.addAll(result, messages);
}
return result;
}
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:16,代码来源:KitkatUtil.java
示例8: beforeHookedMethod
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Intent intent = (Intent) param.args[1];
String action = intent.getAction();
if (action.equals(Intents.SMS_DELIVER_ACTION)
|| action.equals(Intents.WAP_PUSH_DELIVER_ACTION)) {
// already send, treat as anther action
Log.i(TAG, "received deliver action");
intent.setAction("czbix.sms.deliver.finish");
}
}
开发者ID:CzBiX,项目名称:kitkat-sms-patch,代码行数:13,代码来源:Patch.java
示例9: updateDefaultSmsReceiver
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
private void updateDefaultSmsReceiver(Context context, ComponentName componentName, boolean isMms) {
SmsReceiver receiver = isMms ? mmsReceiver : smsReceiver;
if (receiver != null) {
if (receiver.getComponentName().equals(componentName)) {
return;
}
context.unregisterReceiver(receiver);
if (isMms) {
mmsReceiver = null;
} else {
smsReceiver = null;
}
}
if (componentName == null) {
return;
}
receiver = new SmsReceiver(componentName);
context.registerReceiver(receiver, new IntentFilter(isMms
? Intents.WAP_PUSH_RECEIVED_ACTION : Intents.SMS_RECEIVED_ACTION));
if (isMms) {
mmsReceiver = receiver;
} else {
smsReceiver = receiver;
}
}
开发者ID:CzBiX,项目名称:kitkat-sms-patch,代码行数:29,代码来源:Patch.java
示例10: onReceive
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intents.SMS_RECEIVED_ACTION)) {
intent.setAction(Intents.SMS_DELIVER_ACTION);
} else if (intent.getAction().equals(Intents.WAP_PUSH_RECEIVED_ACTION)) {
intent.setAction(Intents.WAP_PUSH_DELIVER_ACTION);
}
intent.setComponent(componentName);
context.sendBroadcast(intent);
}
开发者ID:CzBiX,项目名称:kitkat-sms-patch,代码行数:12,代码来源:SmsReceiver.java
示例11: onReceiveWithPrivilege
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
protected void onReceiveWithPrivilege(Context context, Intent intent, boolean privileged) {
// If 'privileged' is false, it means that the intent was delivered to the base
// no-permissions receiver class. If we get an SMS_RECEIVED message that way, it
// means someone has tried to spoof the message by delivering it outside the normal
// permission-checked route, so we just ignore it.
if (!privileged && intent.getAction().equals(Intents.SMS_RECEIVED_ACTION)) {
return;
}
intent.setClass(context, SmsReceiverService.class);
intent.putExtra("result", getResultCode());
beginStartingService(context, intent);
}
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:14,代码来源:SmsReceiver.java
示例12: onReceiveWithPrivilege
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
protected void onReceiveWithPrivilege(Context context, Intent intent, boolean privileged) {
// If 'privileged' is false, it means that the intent was delivered to the base
// no-permissions receiver class. If we get an SMS_RECEIVED message that way, it
// means someone has tried to spoof the message by delivering it outside the normal
// permission-checked route, so we just ignore it.
if (!privileged && intent.getAction().equals(Intents.SMS_DELIVER_ACTION)) {
return;
}
intent.setClass(context, SmsReceiverService.class);
intent.putExtra("result", getResultCode());
beginStartingService(context, intent);
}
开发者ID:slvn,项目名称:android-aosp-mms,代码行数:14,代码来源:SmsReceiver.java
示例13: asyncWaitForSms
import android.provider.Telephony.Sms.Intents; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@AsyncRpc(description = "Async wait for incoming SMS message.")
public void asyncWaitForSms(String callbackId) {
SmsReceiver receiver = new SmsReceiver(mContext, callbackId);
mContext.registerReceiver(receiver, new IntentFilter(Intents.SMS_RECEIVED_ACTION));
}
开发者ID:google,项目名称:mobly-bundled-snippets,代码行数:7,代码来源:SmsSnippet.java
注:本文中的android.provider.Telephony.Sms.Intents类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论