Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtNfcBroadcastReceiver.java
Go to the documentation of this file.
1// Copyright (C) 2018 Governikus GmbH & Co. KG
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4package org.qtproject.qt.android.nfc;
5
6import android.content.BroadcastReceiver;
7import android.content.Context;
8import android.content.Intent;
9import android.content.IntentFilter;
10import android.nfc.NfcAdapter;
11
12class QtNfcBroadcastReceiver extends BroadcastReceiver
13{
14 final private long qtObject;
15 final private Context qtContext;
16
17 QtNfcBroadcastReceiver(long obj, Context context)
18 {
19 qtObject = obj;
20 qtContext = context;
21 IntentFilter filter = new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED);
22 qtContext.registerReceiver(this, filter);
23 }
24
25 void unregisterReceiver()
26 {
27 qtContext.unregisterReceiver(this);
28 }
29
30 @Override
31 public void onReceive(Context context, Intent intent)
32 {
33 final int state = intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE, NfcAdapter.STATE_OFF);
34 jniOnReceive(qtObject, state);
35 }
36
37 native void jniOnReceive(long qtObject, int state);
38}
PeripheralState state
QPainter Context
static const QString context()
Definition java.cpp:398
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLhandleARB obj
[0]