⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 receivesms.java

📁 jsmsengine 1.1 用于手机开发SMS短信接受发送的开源包
💻 JAVA
字号:
package dk.daimi.jones.app.smsdemo;

import dk.daimi.jones.services.sms.*;
import dk.daimi.jones.impl.sms.*;

/**
 * @author Jonas Thomsen
 *
 * Receives incomming SMSs and displays them on the screen. 
 * 
 */
public class ReceiveSMS {

	public static void main(String[] args) {
		// Anonousmus class for implementing the NMIListener interface
		NMIListener myNMIListener = new NMIListener() {
			public void messageReceived(SMSMessage smsMessage) {
				System.out.println("Received SMS from '" + smsMessage.getAddress() + "'");
				System.out.println("Text: '" + smsMessage.getData() + "'");
			}
		};
		SMS sms = new SMSImpl();
		System.out.print("Starting SMS service... ");
		if (((SMSImpl)sms).open("COM1", "")) { 
			System.out.println("Done!");
			System.out.println("Press Ctrl+C to end the program.");
			// Register reception of incomming messages with the framework
			sms.addNMIListener(myNMIListener);
			// Keep the application running so we can see the result
			try {
				while (true) {
					Thread.sleep(10000);
				}
			} catch( Exception e ) {}
			
		} else {
			System.out.println("Failed!");
		}
		((SMSImpl)sms).close();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -