Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
12public class QtNfcBroadcastReceiver extends BroadcastReceiver
13{
14 final private long qtObject;
15 final private Context qtContext;
16
17 public 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 public void unregisterReceiver()
26 {
27 qtContext.unregisterReceiver(this);
28 }
29
30 public void onReceive(Context context, Intent intent)
31 {
32 final int state = intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE, NfcAdapter.STATE_OFF);
33 jniOnReceive(qtObject, state);
34 }
35
36 public native void jniOnReceive(long qtObject, int state);
37}
native void jniOnReceive(long qtObject, int state)
else opt state
[0]
static void * context
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLhandleARB obj
[2]