2

エンジニアリング プロジェクトでは、基本的に携帯電話をだまして NFC 検索モードから抜け出させ、携帯電話が継続的にエネルギーを放出しているモードにする必要があります。もちろん、設定でNFCを有効にしましたが、それをだまして検索モードを終了させ、継続的にエネルギーを放出させる唯一の方法は、空白のタグの上に置いておくことです.

この NFC ビーム機能: public boolean invokeBeam(Activity activity)を実装してBeamLargeFiles、Android studio で提供されているサンプル コードに埋め込むことを考えていました。

私はアプリ開発に不慣れなので(コーディングの経験はかなりありますが)、それが実現可能かどうか、または適切な場所を探しているかどうかはわかりません. どんな考え、アイデア、助けも大歓迎です!

package com.example.android.beamlargefiles;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.text.Html;
import android.widget.TextView;
import android.view.Menu;

import com.example.android.common.activities.SampleActivityBase;
import com.example.android.common.logger.Log;
import com.example.android.common.logger.LogFragment;
import com.example.android.common.logger.LogWrapper;
import com.example.android.common.logger.MessageOnlyLogFilter;

/**
 * A simple launcher activity containing a summary sample description
 * and a few action bar buttons.
 */
public class MainActivity extends SampleActivityBase {

    public static final String TAG = "MainActivity";

    public static final String FRAGTAG = "BeamLargeFilesFragment";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView sampleOutput = (TextView) findViewById(R.id.sample_output);
        sampleOutput.setText(Html.fromHtml(getString(R.string.intro_message)));

        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        BeamLargeFilesFragment fragment = new BeamLargeFilesFragment();
        transaction.add(fragment, FRAGTAG);
        transaction.commit();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    /** Create a chain of targets that will receive log data */
    @Override
    public void initializeLogging() {
        // Wraps Android's native log framework.
        LogWrapper logWrapper = new LogWrapper();
        // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
        Log.setLogNode(logWrapper);

        // Filter strips out everything except the message text.
        MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
        logWrapper.setNext(msgFilter);

        // On screen logging via a fragment with a TextView.
        LogFragment logFragment = (LogFragment) getSupportFragmentManager()
                .findFragmentById(R.id.log_fragment);
        msgFilter.setNext(logFragment.getLogView());
        logFragment.getLogView().setTextAppearance(this, R.style.Log);
        logFragment.getLogView().setBackgroundColor(Color.WHITE);

        Log.i(TAG, "Ready");
    }
}

android studio 提供の beamlargedata サンプルコードより

4

1 に答える 1