當前位置:首頁 » 安卓系統 » 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();
}

熱點內容
易語言源碼怎麼保存 發布:2025-04-23 01:36:28 瀏覽:157
查看應用數據的存儲路徑 發布:2025-04-23 01:36:18 瀏覽:381
winformaccess資料庫 發布:2025-04-23 01:31:20 瀏覽:166
免費申請騰訊雲伺服器 發布:2025-04-23 01:23:12 瀏覽:731
阿里雲上傳慢 發布:2025-04-23 01:04:10 瀏覽:586
我爸電腦配置給別人看沒什麼事吧 發布:2025-04-23 00:58:54 瀏覽:723
大學編程課程 發布:2025-04-23 00:48:55 瀏覽:470
伺服器的內網ip有什麼用 發布:2025-04-23 00:46:40 瀏覽:958
誅仙3需要什麼配置 發布:2025-04-23 00:29:49 瀏覽:665
什麼是編譯錯誤參數不可選 發布:2025-04-23 00:23:06 瀏覽:520