From 9386cbb3b0b6c448f0f4874f389ba9ae8e18a988 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=98=87=E6=B2=90=E7=91=A4=E3=81=AE=E9=89=B2=E9=88=BD?=
=?UTF-8?q?=E6=B8=8F=E8=AB=BE=E3=81=A5?= <1553809191@qq.com>
Date: Thu, 28 Jul 2022 02:05:18 +0800
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=202.0.1.370=EF=BC=8C=E5=87=8F?=
=?UTF-8?q?=E5=B0=91=E4=BB=A3=E7=A0=81=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?NFC=E5=92=8C=E5=8D=8E=E4=B8=BA=E5=87=BD=E6=95=B0=E7=9A=84?=
=?UTF-8?q?=E5=85=A8=E8=87=AA=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../app/build.gradle | 4 +-
.../com/haohanyh/hamos/huawei/Huawei.java | 2 +
.../hamos/projecty/BaseNFCActivity.java | 35 +--
.../hamos/projecty/HAMOSActivity.java | 1 +
.../haohanyh/hamos/projecty/NFCActivity.java | 18 +-
.../app/src/main/java/utils/NFCHelper.java | 266 ++++++------------
.../app/src/main/res/layout/activity_nfc.xml | 14 +-
.../app/src/main/res/values/strings.xml | 2 +-
.../.haohanyh" | 1 +
README.md | 2 +-
10 files changed, 113 insertions(+), 232 deletions(-)
create mode 100644 "HaohanyhHAMOSProjectY \346\225\231\347\250\213/.haohanyh"
diff --git a/HaohanyhHAMOSProjectY Android/app/build.gradle b/HaohanyhHAMOSProjectY Android/app/build.gradle
index 1513569..3250005 100644
--- a/HaohanyhHAMOSProjectY Android/app/build.gradle
+++ b/HaohanyhHAMOSProjectY Android/app/build.gradle
@@ -10,8 +10,8 @@ android {
minSdk 26
targetSdk 32
versionCode 1
- //2.0版本第362次测试
- versionName "2.0.362.2022.0724.Haohanyh.Basin"
+ //2.0.1版本第370次测试
+ versionName "2.0.1.370.2022.0724.Haohanyh.Basin"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/HaohanyhHAMOSProjectY Android/app/huawei/src/main/java/com/haohanyh/hamos/huawei/Huawei.java b/HaohanyhHAMOSProjectY Android/app/huawei/src/main/java/com/haohanyh/hamos/huawei/Huawei.java
index d60be8c..b24777e 100644
--- a/HaohanyhHAMOSProjectY Android/app/huawei/src/main/java/com/haohanyh/hamos/huawei/Huawei.java
+++ b/HaohanyhHAMOSProjectY Android/app/huawei/src/main/java/com/haohanyh/hamos/huawei/Huawei.java
@@ -282,6 +282,7 @@ public void CreateStringToSearchDeviceIoTDAneedget(String content) {
* ▍和中华人民共和国澳门特别行政区《网络安全法》
* ▍(浩瀚银河旗下网站和等服务不会以任何形式收集敏感信息和大数据分析,并在遵守情况下最大限度公开用户上传数据)
* 浩瀚银河数据保存地址:https://oranme-cdn.haohanyh.com/HAMOS/ProjectY/Device_info.json
+ * 浩瀚银河CDN图形界面地址:https://oranme-cdn.haohanyh.com/files.php?HAMOS/ProjectY#Device_info.json
* 本函数无任何上传到浩瀚银河的任何操作,仅为JSON数据下载判断行为,可安全使用
* 浩瀚银河服务器已能做到7x24不间断运行,不会影响大量用户生产环境。
*/
@@ -320,6 +321,7 @@ public boolean HaohanyhOranMeCDNDecideData(String Url, String S_data_device_id,
If_data_node_id = jsonObj.getString("node_id");
If_data_product_id = jsonObj.getString("product_id");
If_S_data_product_name = jsonObj.getString("product_name");
+
if((S_data_device_id.equals(If_S_data_device_id)) && (data_node_id.equals(If_data_node_id)) && (data_product_id.equals(If_data_product_id)) && (S_data_product_name.equals(If_S_data_product_name))){
Log.v("浩瀚银河:","恭喜您,华为云IoTDA上面有您的设备");
return true;
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/BaseNFCActivity.java b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/BaseNFCActivity.java
index cba2faf..799e068 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/BaseNFCActivity.java
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/BaseNFCActivity.java
@@ -1,9 +1,8 @@
+/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://git.haohanyh.top:3001/Haohanyh/LICENSE */
package com.haohanyh.hamos.projecty;
import android.content.Intent;
import android.os.Bundle;
-import android.text.TextUtils;
-import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Nullable;
@@ -20,50 +19,32 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
nfcHelper = new NFCHelper(this);
}
-
@Override
protected void onResume() {
super.onResume();
//判断设备是否支持NFC功能
- if (nfcHelper.isSupportNFC()) {
+ if (nfcHelper.SupportNFC()) {
//判断设备是否开启NFC功能
- if (nfcHelper.isEnableNFC()) {
- //注册FNC监听器
- nfcHelper.registerNFC(this);
+ if (nfcHelper.EnableNFC()) {
+ //注册NFC监听器
+ nfcHelper.RegisterNFC(this);
} else {
- nfcHelper.showFNCSetting(this);
+ nfcHelper.GoToNFCSetting(this);
}
} else {
- showToast("当前设备不支持NFC功能");
+ Toast.makeText(BaseNFCActivity.this,"当前设备不支持NFC功能",Toast.LENGTH_SHORT).show();
}
}
-
@Override
protected void onPause() {
super.onPause();
- nfcHelper.unRegisterNFC(this);
+ nfcHelper.UnRegisterNFC(this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
- log("Action: " + intent.getAction());
-
- }
-
- public void start(Class clazz) {
- startActivity(new Intent(this, clazz));
}
- public void showToast(String content) {
- if (TextUtils.isEmpty(content))
- return;
- Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
-
- }
-
- public void log(String content) {
- Log.e(getClass().getSimpleName(), content);
- }
}
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/HAMOSActivity.java b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/HAMOSActivity.java
index 0f646e2..a5c14fd 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/HAMOSActivity.java
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/HAMOSActivity.java
@@ -1,3 +1,4 @@
+/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://git.haohanyh.top:3001/Haohanyh/LICENSE */
package com.haohanyh.hamos.projecty;
import static com.haohanyh.hamos.huawei.Huawei.GetHuawei;
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/NFCActivity.java b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/NFCActivity.java
index 20004bb..cad9417 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/NFCActivity.java
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/java/com/haohanyh/hamos/projecty/NFCActivity.java
@@ -1,3 +1,4 @@
+/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://git.haohanyh.top:3001/Haohanyh/LICENSE */
package com.haohanyh.hamos.projecty;
import static com.haohanyh.hamos.projecty.MainActivity.getToBearPiJSON;
@@ -7,7 +8,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
-import android.view.View;
import android.widget.EditText;
import androidx.annotation.Nullable;
@@ -15,6 +15,7 @@
import java.nio.charset.Charset;
public class NFCActivity extends BaseNFCActivity {
+ //初始化两个变量,这个很重要,一个是我们打印目前的参数到GUI页面,一个是判断是否可写数据到小熊派
public EditText NfcData;
private boolean isWrite = false;
@@ -27,6 +28,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
NfcData.post(new Runnable() {@Override public void run() { NfcData.setText(getToBearPiJSON());NfcData.setText(SSRJSON()); }});
}
+ /*
+ * 这个很重要,如果用户填写的值组成JSON,没有满为4的倍数(如176,不是4的倍数)
+ * 那么这个函数就是在JSON最有花括号"}"前,添加相对应的空格而不影响JSON数据
+ * 已经经过多轮灰度测试,暂时没有问题
+ */
private String SSRJSON() {
Log.v("浩瀚银河:","目前JSON文本情况:"+NfcData.getText().toString()+","+"目前JSON在GB2312情况下字节数:"+NfcData.getText().toString().getBytes(Charset.forName("gb2312")).length);
//正确(4的倍数),就按兵不动;反之(非4倍数),就添加空格。
@@ -40,20 +46,14 @@ private String SSRJSON() {
json = json + " ";
}
Log.e("浩瀚银河:","现在您可以点击写入按钮了");
+ isWrite = true;
return json + "}";
}
Log.e("浩瀚银河:","现在您可以点击写入按钮了");
+ isWrite = true;
return NfcData.getText().toString();
}
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.bt_write_text:
- isWrite = true;
- break;
- }
- }
-
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/java/utils/NFCHelper.java b/HaohanyhHAMOSProjectY Android/app/src/main/java/utils/NFCHelper.java
index 3e4a6cf..5b94905 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/java/utils/NFCHelper.java
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/java/utils/NFCHelper.java
@@ -1,7 +1,6 @@
package utils;
-import static android.nfc.NdefRecord.RTD_TEXT;
-
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
@@ -24,76 +23,102 @@
import androidx.appcompat.app.AlertDialog;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
-import java.util.Arrays;
import java.util.Locale;
-/**
- * Created by ljb on 2018/8/1.
- */
public class NFCHelper {
- private static final String TAG = "NFCHelper";
- private static final boolean isDebug = true;
+ //初始化所需用到的东西
+ private NfcAdapter mNfcAdapter;
+ private IntentFilter[] mIntentFilter;
+ private PendingIntent mPendingIntent;
+ private String[][] mTechList;
+ private AlertDialog alertDialog;
- public NFCHelper(Context context) {
- init(context);
+ /*
+ * 初始化
+ */
+ private void init(Context context) {
+ mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
+ mPendingIntent = PendingIntent.getActivity(context, 123, new Intent(context, context.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_IMMUTABLE);
+ } else {
+ mPendingIntent = PendingIntent.getActivity(context, 123, new Intent(context, context.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_ONE_SHOT);
+ }
+ //mPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, context.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
+ mIntentFilter = new IntentFilter[]{
+ new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED)
+ , new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED)
+ , new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED)
+ };
+ mTechList = new String[][]{
+ new String[]{android.nfc.tech.IsoDep.class.getName()}
+ , new String[]{android.nfc.tech.NfcA.class.getName()}
+ , new String[]{android.nfc.tech.NfcB.class.getName()}
+ , new String[]{android.nfc.tech.NfcF.class.getName()}
+ , new String[]{android.nfc.tech.NfcV.class.getName()}
+ , new String[]{Ndef.class.getName()}
+ , new String[]{NdefFormatable.class.getName()}
+ , new String[]{android.nfc.tech.MifareClassic.class.getName()}
+ , new String[]{MifareUltralight.class.getName()}
+ };
}
- /**
+ /*
+ * 调用初始化函数的同时重构
+ */
+ public NFCHelper(Context context) { init(context); }
+
+ /*
* 判断当前设备是否支持NFC功能
*/
- public boolean isSupportNFC() {
- boolean ret = mNfcAdapter != null;
- log("isSupportNFC: " + ret);
- return ret;
+ public boolean SupportNFC() {
+ boolean NFCSupport = mNfcAdapter != null;
+ Log.v("浩瀚银河:", "是否支持NFC: " + NFCSupport);
+ return NFCSupport;
}
- /**
+ /*
* 判断当前设备的NFC功能是否可用
*/
- public boolean isEnableNFC() {
- boolean ret = mNfcAdapter != null && mNfcAdapter.isEnabled();
- log("isEnableNFC: " + ret);
- return ret;
+ public boolean EnableNFC() {
+ boolean NFCEnable = mNfcAdapter != null && mNfcAdapter.isEnabled();
+ Log.v("浩瀚银河:", "是否可用NFC: " + NFCEnable);
+ return NFCEnable;
}
- /**
+ /*
* 注册NFC广播监听
- *
- * @param activity
+ * 浩瀚银河提醒各位开发者:我们在Android 12的灰度测试设备上,发现了NFC注册广播监听的Bug,如果您也遇到了,请按照下面初始化函数修改。
*/
- public void registerNFC(Activity activity) {
+ public void RegisterNFC(Activity activity) {
if (mNfcAdapter != null) {
mNfcAdapter.enableForegroundDispatch(activity, mPendingIntent, null, null);
- log("registerNFC: 注册NFC广播监听");
+ Log.v("浩瀚银河:", "是否注册成功NFC: " + "成功");
}
}
- /**
+ /*
* 注销NFC广播监听
- *
- * @param activity
*/
- public void unRegisterNFC(Activity activity) {
+ public void UnRegisterNFC(Activity activity) {
if (mNfcAdapter != null) {
mNfcAdapter.disableForegroundDispatch(activity);
- log("unRegisterNFC: 注销NFC广播监听");
+ Log.v("浩瀚银河:", "是否注销成功NFC: " + "成功");
}
}
- /**
+ /*
* 显示NFC设置界面
- *
- * @param context
+ * 一般为如果您NFC没有提前开启而进行的函数,当然,如果出现了此页面,去打开了NFC再回来,也是没有问题的。
*/
- public void showFNCSetting(final Context context) {
+ public void GoToNFCSetting(final Context context) {
if (alertDialog == null) {
alertDialog = new AlertDialog.Builder(context)
- .setTitle("NFC")
+ .setTitle("Haohanyh-ProjectY-NFC")
.setMessage("当前应用需要您开启NFC,是否立即去设置界面开启?")
.setPositiveButton("去设置", new DialogInterface.OnClickListener() {
+ @SuppressLint("ObsoleteSdkInt")
@Override
public void onClick(DialogInterface dialog, int which) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
@@ -107,12 +132,9 @@ public void onClick(DialogInterface dialog, int which) {
alertDialog.show();
}
- /**
+ /*
* 向NFC标签中写入NDEF格式数据
- *
- * @param intent
- * @param text
- * @return
+ * 目前暂不确认护花使者我们该写入的是NFC标签还是Tag,正在研究。
*/
public boolean writeNFC_NDEF(Intent intent, String text) {
if (intent != null && text != null) {
@@ -122,49 +144,10 @@ public boolean writeNFC_NDEF(Intent intent, String text) {
return false;
}
- //向TAG中写入非NDEF格式数据
- private boolean writeMUTag(Tag tag, String text) {
- if (tag != null && text != null) {
- MifareUltralight ultralight = MifareUltralight.get(tag);
- if (ultralight != null) {
- byte[] textBytes = text.getBytes(Charset.forName("GB2312"));
- int length = textBytes.length;
- int page;
- if (length % 4 == 0) {
- page = length / 4;
- } else {
- log("writeMUTag: 数据字节长度必须为4的倍数");
- return false;
- }
- if (page > 0 && page <= 12) {
- try {
- ultralight.connect();
- for (int i = 0; i < page; i++) {
- byte[] bytes = new byte[4];
- System.arraycopy(textBytes, 4 * i, bytes, 0, 4);
- ultralight.writePage(4 + i, bytes);
- log("writeMUTag: page = " + (4 + i) + ", 数据写入成功--> ");
- }
- return true;
-
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- ultralight.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- log("writeMUTag: 数据写入失败");
- return false;
- }
-
-
- //向TAG中写入NDEF格式数据
+ /*
+ * 向TAG中写入NDEF格式数据
+ * 目前暂不确认护花使者我们该写入的是NFC标签还是Tag,正在研究。
+ */
private boolean writeTag(Tag tag, NdefMessage message) {
if (tag != null && message != null) {
Ndef ndef = Ndef.get(tag);
@@ -173,20 +156,18 @@ private boolean writeTag(Tag tag, NdefMessage message) {
return false;
}
- //nfc标签未格式化,或没有分区,先进行格式化,并将数据写入
+ /*
+ * nfc标签未格式化,或没有分区,先进行格式化,并将数据写入
+ */
private boolean writeNoNdefMessage(Tag tag, NdefMessage message) {
- //Ndef格式类
NdefFormatable format = NdefFormatable.get(tag);
if (format != null) {
try {
format.connect();
format.format(message);
- log("writeNoNdefMessage: 数据写入成功--> " + message);
+ Log.v("浩瀚银河:", "是否数据写入成功NFC: " + "成功" + message);
return true;
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (FormatException e) {
+ } catch (IOException | FormatException e) {
e.printStackTrace();
} finally {
try {
@@ -199,7 +180,9 @@ private boolean writeNoNdefMessage(Tag tag, NdefMessage message) {
return false;
}
- //nfc标签支持NDEF数据,向nfc标签中写入NDEF数据
+ /*
+ * nfc标签支持NDEF数据,向nfc标签中写入NDEF数据
+ */
private boolean writeNdefMessage(Ndef ndef, NdefMessage message) {
//判断是否可写
if (ndef.isWritable()) {
@@ -209,12 +192,9 @@ private boolean writeNdefMessage(Ndef ndef, NdefMessage message) {
try {
ndef.connect();
ndef.writeNdefMessage(message);
- log("writeNdefMessage: 数据写入成功--> ");
+ Log.v("浩瀚银河:", "是否数据写入成功NFC: " + "成功" + message);
return true;
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (FormatException e) {
+ } catch (IOException | FormatException e) {
e.printStackTrace();
} finally {
try {
@@ -229,7 +209,9 @@ private boolean writeNdefMessage(Ndef ndef, NdefMessage message) {
}
- //生成NDEF格式的数据
+ /*
+ *生成NDEF格式的数据
+ */
private NdefRecord createTextRecord(String languageCode, String text) {
if (text == null)
throw new NullPointerException("text is null");
@@ -242,7 +224,6 @@ private NdefRecord createTextRecord(String languageCode, String text) {
} else {
languageCodeBytes = Locale.getDefault().getLanguage().getBytes(Charset.forName("US-ASCII"));
}
- // We only have 6 bits to indicate ISO/IANA language code.
if (languageCodeBytes.length >= 64) {
throw new IllegalArgumentException("language code is too long, must be <64 bytes.");
}
@@ -256,60 +237,8 @@ private NdefRecord createTextRecord(String languageCode, String text) {
return new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, null, buffer.array());
}
- private void log(String content) {
- if (isDebug) {
- Log.e(TAG, content);
- }
- }
-
- //字节数组转换成十六进制字符串
- private String bytesToHexString(byte[] bArray) {
- StringBuilder sb = new StringBuilder(bArray.length);
- String sTemp;
- for (byte aBArray : bArray) {
- sTemp = Integer.toHexString(0xFF & aBArray);
- if (sTemp.length() < 2)
- sb.append(0);
- sb.append(sTemp.toUpperCase());
- }
- return sb.toString();
- }
-
- //解析NdefRecord成String字符串
- private String parseTextRecord(NdefRecord ndefRecord) {
- //判断数据是否为NDEF格式
- //判断可变的长度的类型
- if (ndefRecord.getTnf() != NdefRecord.TNF_WELL_KNOWN || !Arrays.equals(ndefRecord.getType(), RTD_TEXT)) {
- log("parseTextRecord: NFC卡数据类型不正确");
- return null;
- }
- try {
- //获得字节数组,然后进行分析
- byte[] payload = ndefRecord.getPayload();
- //下面开始NDEF文本数据第一个字节,状态字节
- //判断文本是基于UTF-8还是UTF-16的,取第一个字节"位与"上16进制的80,16进制的80也就是最高位是1,
- //其他位都是0,所以进行"位与"运算后就会保留最高位
- String textEncoding = ((payload[0] & 0x80) == 0) ? "UTF-8" : "UTF-16";
- //3f最高两位是0,第六位是1,所以进行"位与"运算后获得第六位
- int languageCodeLength = payload[0] & 0x3f;
- //下面开始NDEF文本数据第二个字节,语言编码
- //获得语言编码
-// String languageCode = new String(payload, 1, languageCodeLength, "US-ASCII");
- //下面开始NDEF文本数据后面的字节,解析出文本
- String ret = new String(payload, languageCodeLength + 1, payload.length - languageCodeLength - 1, textEncoding);
- log("parseTextRecord: " + ret);
- return ret;
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- log("parseTextRecord: 数据解析失败");
- return null;
- }
-
- /**
+ /*
* 手机震动提醒
- *
- * @param context
*/
public void vibrate(Context context) {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
@@ -319,37 +248,4 @@ public void vibrate(Context context) {
}
}
-
- private NfcAdapter mNfcAdapter;
- private IntentFilter[] mIntentFilter;
- private PendingIntent mPendingIntent;
- private String[][] mTechList;
- private AlertDialog alertDialog;
-
- /**
- * 初始化
- *
- * @param context
- */
- private void init(Context context) {
- mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
- mPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, context.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
- mIntentFilter = new IntentFilter[]{
- new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED)
- , new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED)
- , new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED)
- };
- mTechList = new String[][]{
- new String[]{android.nfc.tech.IsoDep.class.getName()}
- , new String[]{android.nfc.tech.NfcA.class.getName()}
- , new String[]{android.nfc.tech.NfcB.class.getName()}
- , new String[]{android.nfc.tech.NfcF.class.getName()}
- , new String[]{android.nfc.tech.NfcV.class.getName()}
- , new String[]{Ndef.class.getName()}
- , new String[]{NdefFormatable.class.getName()}
- , new String[]{android.nfc.tech.MifareClassic.class.getName()}
- , new String[]{MifareUltralight.class.getName()}
- };
- }
-
}
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/res/layout/activity_nfc.xml b/HaohanyhHAMOSProjectY Android/app/src/main/res/layout/activity_nfc.xml
index a7a070d..f2d42f6 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/res/layout/activity_nfc.xml
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/res/layout/activity_nfc.xml
@@ -19,14 +19,14 @@
android:layout_width="match_parent"
android:layout_height="15dp" />
-
+ android:background="@color/Pink_is_fancy"
+ android:textColor="@color/white"
+ android:textSize="24sp"
+ android:gravity="center" />
\ No newline at end of file
diff --git a/HaohanyhHAMOSProjectY Android/app/src/main/res/values/strings.xml b/HaohanyhHAMOSProjectY Android/app/src/main/res/values/strings.xml
index 5105fd2..051378c 100644
--- a/HaohanyhHAMOSProjectY Android/app/src/main/res/values/strings.xml
+++ b/HaohanyhHAMOSProjectY Android/app/src/main/res/values/strings.xml
@@ -4,5 +4,5 @@
Haohanyh HAMOS:LiGHTs Project
护花使者 Android版
点我浇花
- NFC NDEF数据写入
+ NFC NDEF数据写入\n 请直接靠近小熊派NFC \n 2.0.1.370版本已彻底解决自动化
\ No newline at end of file
diff --git "a/HaohanyhHAMOSProjectY \346\225\231\347\250\213/.haohanyh" "b/HaohanyhHAMOSProjectY \346\225\231\347\250\213/.haohanyh"
new file mode 100644
index 0000000..8eafa8c
--- /dev/null
+++ "b/HaohanyhHAMOSProjectY \346\225\231\347\250\213/.haohanyh"
@@ -0,0 +1 @@
+期待我们在仓库项目和51cto的教程吧~
\ No newline at end of file
diff --git a/README.md b/README.md
index 33e9687..b16d48c 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ public boolean HaohanyhOranMeCDNDecideData(...) throws JSONException {...}
目前完工情况:
-⏪其实这一份项目,我们早就在5月28号前,买下来,并且在6月初我们自己灰度测试期间,就已经完成了。同时也感谢小熊派开源社区和王羚本人提供的开发案例。
+⏪其实这一份项目,我们早就在5月28号前,买下来护花使者套装,并且在6月初我们自己灰度测试期间,就已经完成了。同时也感谢小熊派开源社区和王羚本人提供的开发案例。
* 护花使者Hardware区: 未来会做些C代码上面的优化,尝试尝试。
* 护花使者HarmonyOS HAP区: 目前参考的是来自Gitee护花使者仓库上面的HAP,本人还未有HarmonyOS操作系统的手机,目前开发受阻。