Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Api 34 error Android 14 #505

Open
DalterioRaffaele opened this issue Apr 4, 2024 · 4 comments
Open

Android Api 34 error Android 14 #505

DalterioRaffaele opened this issue Apr 4, 2024 · 4 comments

Comments

@DalterioRaffaele
Copy link

Removed Methods

void disableForegroundNdefPush(Activity) |  
void enableForegroundNdefPush(Activity, NdefMessage) |  
boolean invokeBeam(Activity) |  
boolean isNdefPushEnabled() |  
void setBeamPushUris(Uri[], Activity) |  
void setBeamPushUrisCallback(CreateBeamUrisCallback, Activity) |  
void setNdefPushMessage(NdefMessage, Activity) |  
void setNdefPushMessageCallback(CreateNdefMessageCallback, Activity) |  
void setOnNdefPushCompleteCallback(OnNdefPushCompleteCallback, Activity) |  
Added Methods
NfcAntennaInfo getNfcAntennaInfo()

Error build android devices sdk 34

[cordova] nfcAdapter.setNdefPushMessage(p2pMessage, getActivity());

[cordova] symbol: method setNdefPushMessage(NdefMessage,Activity)

[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:585: error: cannot find symbol
[cordova] } else if (!nfcAdapter.isNdefPushEnabled()) {
[cordova] ^

[cordova] symbol: method isNdefPushEnabled()
[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:588: error: cannot find symbol

[cordova] nfcAdapter.setOnNdefPushCompleteCallback(NfcPlugin.this, getActivity());
[cordova] ^
[cordova] symbol: method setOnNdefPushCompleteCallback(NfcPlugin,Activity)
[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:590: error: cannot find symbol

[cordova] nfcAdapter.setBeamPushUris(uris, getActivity());

[cordova] ^
[cordova] symbol: method setBeamPushUris(Uri[],Activity)
[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] /platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:611: error: cannot find symbol

[cordova] } else if (!nfcAdapter.isNdefPushEnabled()) {

[cordova] ^
[cordova] symbol: method isNdefPushEnabled()
[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:614: error: cannot find symbol
[cordova] nfcAdapter.setNdefPushMessage(p2pMessage, getActivity());

[cordova] symbol: method setNdefPushMessage(NdefMessage,Activity)

[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:615: error: cannot find symbol

[cordova] nfcAdapter.setOnNdefPushCompleteCallback(NfcPlugin.this, getActivity());
[cordova] ^

[cordova] symbol: method setOnNdefPushCompleteCallback(NfcPlugin,Activity)

[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:631: error: cannot find symbol

[cordova] nfcAdapter.setNdefPushMessage(null, getActivity());
[cordova] ^

[cordova] symbol: method setNdefPushMessage(,Activity)
[cordova] location: variable nfcAdapter of type NfcAdapter

[cordova] platforms/android/app/src/main/java/com/chariotsolutions/nfc/plugin/NfcPlugin.java:643: error: cannot find symbol

[cordova] nfcAdapter.setBeamPushUris(null, getActivity());
[cordova] ^
[cordova] symbol: method setBeamPushUris(,Activity)

[cordova] location: variable nfcAdapter of type NfcAdapter
[cordova] Note: Some input files use or override a deprecated API.

[cordova] Note: Recompile with -Xlint:deprecation for details.

@PleahMaCaka
Copy link

Same here, is there some solution?

@Logan-Fidelitab
Copy link

Same problem here, a patch would be highly appreciated ;)

@DocBO
Copy link

DocBO commented May 10, 2024

Hi, after fiddling around I found a simple solution that worked for me: I removed all lines which are API 34 incompatible in the java code.

Actually all the lines with these deprecated functions: void disableForegroundNdefPush(Activity) | 
void enableForegroundNdefPush(Activity, NdefMessage) | 
boolean invokeBeam(Activity) | 
boolean isNdefPushEnabled() | 
void setBeamPushUris(Uri[], Activity) | 
void setBeamPushUrisCallback(CreateBeamUrisCallback, Activity) | 
void setNdefPushMessage(NdefMessage, Activity) | 
void setNdefPushMessageCallback(CreateNdefMessageCallback, Activity) | 
void setOnNdefPushCompleteCallback(OnNdefPushCompleteCallback, Activity) |

Since I had in mind a very very simple reader in my app, this worked. I have no idea what these lines were actually doing.

Also if you wonder how to register functions on Android, the doku was kind of incomplete on that:

this.nfc.addMimeTypeListener("text/demo", this.onNfc).subscribe( (event: any)=>
{ console.log("subscribed.....", event); });
this.nfc.addTagDiscoveredListener(this.onNfc).subscribe( (event: any)=>
{ console.log("subscribed.....", event); });
this.nfc.addNdefListener(this.onNfc).subscribe( (event: any)=>
{ console.log("subscribed.....", event); });

@bmarsaud
Copy link

All these functions are related to Android Beam wich has been deprecated in API 29 and removed in API 34 : https://developer.android.com/about/versions/10/behavior-changes-all#beam-deprecation

It should indeed be removed from this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants