Активити
Код: Выделить всё
public class AutoSMSActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Регистрация Приемника широковещательных намерений
IntentFilter filter = new IntentFilter(SMS_RECEIVED);
registerReceiver(emergencyResponseRequestReceiver, filter);
}
// Обработка события получение SMS
BroadcastReceiver emergencyResponseRequestReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context _context, Intent _intent) {
if (_intent.getAction().equals(SMS_RECEIVED)) {
abortBroadcast();
Bundle bundle = _intent.getExtras();
if (bundle != null) {
} // if (bundle != null)
} // if (_intent.getAction().equals(SMS_RECEIVED))
}
};
}Код: Выделить всё
<activity
android:label="@string/app_name"
android:name=".AutoSMSActivity" >
<intent-filter android:priority="999">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>