2013-12-18 20 views
0

我想tosave運營商名稱也,但我找不到任何適當的標籤,任何身體請幫助我這個。如何使用操作員名稱將短信插入收件箱?

ContentValues values = new ContentValues(); 
values.put("address", originatingAddress); 
values.put("body", sampleContent); 
values.put("date", timeStamp);    
context.getContentResolver().insert(Uri.parse("content://sms/inbox"), values); 
+0

運營商名字的意思? – Riser

+0

@Segi我猜,他的意思是移動運營商的名稱(即移動網絡提供商)。 –

+0

是如何在短信中調用網絡名稱 – Starin

回答

0

爲了得到運營商的名稱,你可以使用:

TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)); 
String OperatorName = manager.getNetworkOperatorName(); 

,然後只要你想用它在你的代碼或類似如下:

ContentValues values = new ContentValues(); 
values.put("address", originatingAddress); 
values.put("body", sampleContent); 
values.put("date", timeStamp);  
values.put("body", OperatorName);   
context.getContentResolver().insert(Uri.parse("content://sms/inbox"), values); 
+0

我們是否在該收件箱內容提供商中有**運營商**列? –

+0

是例如; abc(短信內容),日期和時間,然後是運營商/網絡名稱 – Starin