<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter" />
이 잘 작동합니다.
사용자가 나는 사용자가 내 측정 활동의 내 에서 onCreate이 점을 추가, 그래서 그가 태그에서 데이터를 전송할 수 있습니다 전에 먼저 로그인 할 로그인하지 않은 경우
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.sessionManager = new SessionManager(this);
this.sessionManager.login();
this.setContentView(R.layout.activity_measure);
this.nfcAdapter = NfcAdapter.getDefaultAdapter(this);
this.pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
this.filters = new IntentFilter[] { ndef, };
this.techLists = new String[][] { new String[] { android.nfc.tech.NfcV.class.getName() } };
this.textViewYear = (TextView) findViewById(R.id.measure_textview_year);
this.textViewMonthDay = (TextView) findViewById(R.id.measure_textview_month_day);
this.textViewTime = (TextView) findViewById(R.id.measure_textview_time);
this.textViewGlucose = (TextView) findViewById(R.id.measure_textview_glucose);
new StartReadTask().execute();
}
그러나 사용자가 자신이 있기 때문에이 구현의 내 메인 메뉴로 리디렉션됩니다 로그인 후 : 여기에 언급 된 'MainActivity는'내 메인 메뉴
/**
*
* @param v
*/
@Override
public void onClick(View view) {
String username = this.textEditUsername.getText().toString();
String password = this.textEditPassword.getText().toString();
if(username.trim().length() > 0 && password.trim().length() > 0){
if(username.equals("test") && password.equals("test")){
this.sessionManager.createLoginSession("Test-Name", "Test-Email");
Intent intent = new Intent(this.getApplicationContext(), MainActivity.class);
this.startActivity(intent);
this.finish();
} else {
this.dialogAlertManager.showAlertDialog(LoginActivity.this, "Login failed..", "Username or Password is incorrect", false);
}
} else {
this.dialogAlertManager.showAlertDialog(LoginActivity.this, "Login failed..", "Please enter username and password", false);
}
}
입니다
. 하지만 내 활동에 로 리디렉션하려는 활동을 원하지만 어떻게 할 수 있는지 모르겠습니다. "정상"로그인 후, nfc 의도없이, 메인 메뉴 으로 리디렉션하는 앱이 필요하지만 nfc 인 텐트로 측정 활동으로 리디렉션하려고합니다.또한 사용자가 이미 로그인 한 경우 태그의 데이터가 즉시 으로 전송되기를 원합니다. 이제 내가 데이터를 전송하려는 경우 휴대 전화에 태그를 가까이 두어 측정 활동을 시작하고 멀리두고 다시 데이터를 전송하는 것보다 데이터를 전송하십시오.
어떻게 둘 다 할 수 있습니까?