當前位置:首頁 » 安卓系統 » android獲取簡訊

android獲取簡訊

發布時間: 2023-06-14 07:56:32

『壹』 android studio開發怎麼獲取手機簡訊

1.點擊一個按鈕就會顯示系統的聯系人列表,當用戶點擊聯系人之後就會看到詳細的名字和電話。
2.具體的代碼如下:首先在AndroidManifest.xml文件中配置用戶許可權。
<uses-permission android:name="android.permission.READ_CONTACTS"/>11

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.dragon.testevent.MainActivity">

『貳』 android 6.0 讀取簡訊需要動態許可權嗎

這類的許可權不需要動態申請,需要這個許可權的時候還是按照以往的做法,在清單文件中申請相應的許可權即可,在安裝的時候會展示給用戶,用戶同意安裝就獲取相應的許可權。寫法舉例如下:
清單文件中:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deepai.paipai">

<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
........

『叄』 android自動獲取簡訊驗證碼有什麼安全隱患

自動獲取簡訊驗證碼,那麼這個應用肯定獲取到了讀取你簡訊的許可權,所以安全隱患就在它可以得到你所有的簡訊信息

『肆』 android開發怎樣獲取系統簡訊指定內容求大神啊!

Java代碼
// android獲取簡訊所有內容
// 注意設置許可權[添加到AndroidMainfest.xml] <uses-permission android:name="android.permission.READ_SMS" />

public String getSmsInPhone()
{
final String SMS_URI_ALL = "content://sms/";
final String SMS_URI_INBOX = "content://sms/inbox";
final String SMS_URI_SEND = "content://sms/sent";
final String SMS_URI_DRAFT = "content://sms/draft";

StringBuilder smsBuilder = new StringBuilder();

try{
ContentResolver cr = getContentResolver();
String[] projection = new String[]{"_id", "address", "person",
"body", "date", "type"};
Uri uri = Uri.parse(SMS_URI_ALL);
Cursor cur = cr.query(uri, projection, null, null, "date desc");

if (cur.moveToFirst()) {
String name;
String phoneNumber;
String smsbody;
String date;
String type;

int nameColumn = cur.getColumnIndex("person");
int phoneNumberColumn = cur.getColumnIndex("address");
int smsbodyColumn = cur.getColumnIndex("body");
int dateColumn = cur.getColumnIndex("date");
int typeColumn = cur.getColumnIndex("type");

do{
name = cur.getString(nameColumn);
phoneNumber = cur.getString(phoneNumberColumn);
smsbody = cur.getString(smsbodyColumn);

SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
Date d = new Date(Long.parseLong(cur.getString(dateColumn)));
date = dateFormat.format(d);

int typeId = cur.getInt(typeColumn);
if(typeId == 1){
type = "接收";
} else if(typeId == 2){
type = "發送";
} else {
type = "";
}

smsBuilder.append("[");
smsBuilder.append(name+",");
smsBuilder.append(phoneNumber+",");
smsBuilder.append(smsbody+",");
smsBuilder.append(date+",");
smsBuilder.append(type);
smsBuilder.append("] ");

if(smsbody == null) smsbody = "";
}while(cur.moveToNext());
} else {
smsBuilder.append("no result!");
}

smsBuilder.append("getSmsInPhone has executed!");
} catch(SQLiteException ex) {
Log.d("SQLiteException in getSmsInPhone", ex.getMessage());
}
return smsBuilder.toString();
}

熱點內容
java惡作劇小程序 發布:2025-02-07 23:53:48 瀏覽:670
openvas源碼 發布:2025-02-07 23:48:14 瀏覽:318
面java 發布:2025-02-07 23:36:21 瀏覽:617
編譯原理練習題第三章答案 發布:2025-02-07 23:35:05 瀏覽:752
爐石寫腳本 發布:2025-02-07 23:31:24 瀏覽:985
stdstring源碼 發布:2025-02-07 23:26:46 瀏覽:782
伺服器在手機上怎麼開 發布:2025-02-07 23:25:07 瀏覽:734
我的世界怎麼進2s2t伺服器 發布:2025-02-07 23:08:47 瀏覽:925
丁霞訪問 發布:2025-02-07 22:56:19 瀏覽:855
java中set集合 發布:2025-02-07 22:43:34 瀏覽:31