問題タブ [ndef]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
1572 参照

android - ActivityInstrumentationTestCase2 を使用して、Intent で入力データ (NDEF メッセージ) を渡すことにより、Android アプリをテストします。

長い間、ここ StackOverflow のさまざまな投稿を読んで問題を解決できましたが、今では私の問題が非常に興味深いものになっています。私は立ち往生しており、誰かが私にいくつかのヒントを与えることができるかもしれません:

ActivityInstrumentationTestCase2を使用して Android アプリケーションをテストしたいと思います。私のテスト シナリオは次のようなものです。 Android デバイスの DB にいくつかのテスト データ セット (16 進文字列、有効および無効な NDEF メッセージのエンコード) があります。テストしたいアプリへの呼び出しを含む DB の行エントリごとに 1 つのテスト関数を持つ Java ファイルを生成します。

これらの関数の 1 つの例を次に示します。

ご覧のとおり、私は Robotium フレームワークを利用し、よくある質問とチュートリアルに従って、これらすべてをセットアップしました (特に: https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles ) 。

I am using a specialised Instrumentation Runner, which is able to write the results in a xml file and seems suitable for my needs; here is my Manifest file:

What I have tried/achieved so far:

  • The apps I would like to test are third party apps, so I re-signed them with my debug key. (works)
  • Since I would like to test different apps, I implemented the generation of Java file containing the test cases on the phone; so by button click a *.java file holding all my tests (constructor, setUp(), testNdefPush0() ... testNdefPush100(), tearDown() ) and a suitable Manifest.xml is generated on the phone. Then these files are pulled to a PC, compiled (ant clean, ant debug, ant install -r /path/to/target.apk) in a test project and installed on the phone
  • I can run tests using adb shell:

    adb -d shell am instrument -w -r -e class de.nfc.tests.NfcTestCase -e junitOutputDirectory /mnt/sdcard/ de.nfc/pl.polidea.instrumentation.PolideaInstrumentationTestRunner

  • in case the test data are valid, instrumentation works and generates a xml file having the results on sdcard.

  • in case the test data is invalid (see example) Instrumentation crashes and does not continue with the following tests:

    INSTRUMENTATION_RESULT: longMsg=java.lang.NullPointerException: Unable to start activity ComponentInfo{se.anyro.nfc_reader/se.anyro.nfc_reader.TagViewer}: java.lang.NullPointerException

Question

How can I achieve, that tests, which failed are logged as failed, and JUnit continues with the following tests.

I found here a similar question Android JUnit test suite hangs after Activity throws NullPointerException in one test case, but no replies so far :(

Has anyone experienced in testing (third) party apps by passing test data via an Intent to them and can share/provide me some advice/experience?

I do hope I made the problem clear, cause it is quite complex setup and I hope I mentioned all relevant facts for someone not familiar with the topic (you know forest and trees ;) ) If not, don't mind to ask, I'll try to explain :D

0 投票する
1 に答える
852 参照

java - AndroidNFCがタップで正しいクラスを開かない

CardActivity2つのクラスのアプリがあります。NFCタグをタップ/スワイプしたときに2番目のクラスを開くためにアプリが必要です。アプリは正常に開きますがMainActivity、の代わりに実行されCardActivityます。

これが私のマニフェストの問題であると推測するのは危険ですが、それは正しいように見えます。ここでは関係ありません:

別のアプリでタグを開いて内容を表示したので、タグ自体は正しいと確信しています。

以下は2つのクラスです。

CardActivity:

主な活動:

これが私がタグを書くために使用したコードです。ちなみに、これは別のアプリで行われます。

0 投票する
1 に答える
206 参照

android - NFC - NdfMessage を iOS に渡すことはできますか?

NFC技術を使用して別のAndroidデバイスにデータを渡すAPPを開発しています

しかし、NdfMessage を iOS デバイスに渡すことはできますか?

iOS デバイスに外部 NFC チップがある場合

0 投票する
2 に答える
1154 参照

android - Easy NFC url sharing

I'm working on a wikipedia reader where I want the user to be able to share the article he is reading to a friend using NFC. I dont want to be able to open these intents or anything fancy like that, just allow the friend to open up the url in the browser of his choice. I'm using a webview so getting ahold of the url won't be hard.

I've been searching the internet for some kind of example that is this easy but I haven't found anything simple enough. Do any of you have any recommendations for tutorials or examples?

0 投票する
1 に答える
366 参照

java - よく知られているタイプのandroidnfcインテントフィルター

次のタイプをフィルタリングしたい:

urn:nfc:wkt:Hs

アンドロイドマニフェストで。

私は次のようにデータを書きます:

タイプを正しくフィルタリングするにはどうすればよいですか?

ありがとう。

0 投票する
2 に答える
3715 参照

c++ - NDEFのNFCタグを非NDEFに変換する方法

NDEF形式のNFCタグを再びRaw形式に変換する方法はありますか?つまり、非NDEFにする方法はありますか?

前もって感謝します

0 投票する
1 に答える
847 参照

android - Samsung Nexus S vs HTC - NFC インテント フィルター + AAR

AAR を NFC タグに保存します。Nexus S (Android 4.1.1) で TAG をスキャンすると、NfcAdapter.ACTION_NDEF_DISCOVERED が取得され、NFCReaderActivity が直接開始されます。

HTC X (Android 4.0.3) で同じことを行うと、アプリケーションは起動しますが、android.intent.action.MAIN を取得するだけなので、NFCReaderActivity が表示されず、タグがスキャンされません。

これは Samsung Nexus S では機能しますが、HTC では機能しません。

これは私のアクティビティとフィルターです。

誰かアイデア?


編集:

これは HTC では機能しますが、Samsung Nexus S では機能しません。

ここで、次の例外 @ HTC が発生しました。これは、私が知らない問題かもしれません: スタック:


おそらく問題はバージョン 4.1.1 と 4.0.3 の違いです。わかりません: 事実: Samsung では Ndef のみが動作します。

0 投票する
1 に答える
1569 参照

android - NFC タグが Android のブラウザで URL を開けない

次の URL を含む Mifare クラシック タグに NDEF メッセージを記録しました。

Androidフォンのデータベースからデータを読みたい場所からWebサーバーにリンクしています。そのアドレスをブラウザーに入力すると、要求されたページが正しく開きます。しかし、NFC タグを使用して開こうとすると、次のような白い画面が表示されます。

他のアドレスの保存 (私は google.com を試しました) は問題なく動作します。では、NDEF レコードでの PHP または IP アドレスの使用に関する既知の問題があるのでしょうか? または、なぜそれが機能しないのか、他の考えはありますか?

メッセージの HEX コードは次のとおりです。

これは本当に緊急です、誰かが助けてくれるとうれしいです!

0 投票する
1 に答える
454 参照

android - NDEF_DISCOVEREDはSamsungGalaxyS3では機能しません

私は本当に奇妙だと思う問題を抱えています。NdefMessageを含むタグがスキャンされたときに起動する必要があるアプリケーションがあります。これはすべて、Galaxy Nexus、Nexus S、HTC one Xで正常に機能しますが、Galaxy S3でこれを実行しようとすると、アプリケーションが表示されません。

私のインテントフィルターは次のようになります。

これにより、NdefMessageを含むタグがスキャンされるたびにアプリチューザーにアプリケーションが表示されます。Galaxy S3でこれを解決するには、TAG_DISCOVEREDを追加する必要があります。しかし、これは私が望んでいることではありません。スキャンするすべてのタグでpopsupになっているからです。

他の誰かがこの行動を見たことがありますか?

編集:

また、ndefテクノロジーをチェックするTECH_DISCOVEREDインテントフィルターも含まれているため、問題は解決しません。

0 投票する
1 に答える
515 参照

android - Ndef writeNdefMessage で NFCSTATUS_INSUFFICIENT_STORAGE エラーをキャプチャする

Ndef.writeNdefMessage を使用して NFC タグに書き込みを行っているときに、catch ブロックで IOException エラーが発生します。Logcat を確認すると、PhLibNfc_Ndef_Write 関数が NFCSTATUS_INSUFFICIENT_STORAGE エラーをトリガーし、実質的に IOException をトリガーしたことが示されました。アプリ層でこの NFCSTATUS_INSUFFICIENT_STORAGE エラーをキャッチする方法はありますか。私はたくさんグーグルで検索しましたが、常に PhLibNfc_Ndef_Write 関数のソース コードに行き着きました。

タグへの書き込みに使用するコード

私が遭遇したlogcatエラー

NFCSTATUS_INSUFFICIENT_STORAGE エラーをキャプチャする方法はありますか?