Android Question Why B4A Application creates two shortcuts

Hello,
I made an NFC Mifare wrapper, but when I generate the application in b4a it creates two shortcuts

this is the manifest file that I use
AndroidManifest.xml:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)

AddActivityText(Mifare,
<intent-filter>
    <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
            
<!-- NFC Tech Filter -->
<intent-filter>
    <action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
            
<meta-data
    android:name="android.nfc.action.TECH_DISCOVERED"
    android:resource="@xml/filter_nfc" />)

SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
 
CreateResource(xml, filter_nfc.xml,
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <tech-list>
    <tech>android.nfc.tech.MifareClassic</tech>
  </tech-list>
  <tech-list>
    <tech>android.nfc.tech.MifareUltralight</tech>
  </tech-list>
  <tech-list>
    <tech>android.nfc.tech.Ndef</tech>
  </tech-list>
</resources>) 

SetActivityAttribute(Main, android:name, ".main")
SetActivityAttribute(Mifare, android:name, ".mifare")
 
'End of default text.
 
I call the intent filter from the java code that I made, it is to capture a card reading event, it works correctly, the only thing is that it creates two shortcuts
code java:
/* Inicializa el wrapper */
    public void initialize( final  BA ba, String eventName, IntentWrapper intentWrapper ) {
        this.ba = ba;
        this.eventName = eventName.toLowerCase(BA.cul);
        this.context = ba.context;
        mIntent =  intentWrapper.getObject();
        mIntent.setAction("android.nfc.action.TECH_DISCOVERED");
        ba.activity.startActivity(mIntent);
        this.mResult = " ";
        BA.Log("ApiMifare Initialize " + mIntent);
    }

    /**
     * Check for NFC hardware, Mifare Classic support and for external storage.
     * If the directory structure and the std. keys files is not already there
     * it will be created. Also, at the first run of this App, a warning
     * notice will be displayed.
     * see #copyStdKeysFilesIfNecessary()
     */
    public void onCreate() {

        /*
       *   Inicialización del Pending Intent para que sea esta aplicación la prioridad cuando esté abierta
       */
        pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
        mAdapter = NfcAdapter.getDefaultAdapter(context);

        if (mAdapter == null) {
            BA.Log("Active NFC en su dispositivo");
            return;
        }

        /* Se hace un PendingIntent para darle prioridad a esta aplicación
         *  de que se quede abierta cuando se detecte un tag. Android "llena" este intent  con los detalles del tag cuando se escanea.
         */
        IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
        intentFiltersArray = new IntentFilter[] {ndef, };
        techListsArray = new String[][] { new String[] { MifareClassic.class.getName() } };

        Intent intent = ba.activity.getIntent();
        if (intent == null) {
            BA.Log("La actividad no se ha llamado mediante un intent.");
        }

        BA.Log("onCreate Intent : " + intent);

        performTagOperations( ba.activity.getIntent() );
    }

code B4A:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Public card As MifareK5

    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("mifare_image")
    ImageView1.Bitmap = LoadBitmap(File.DirAssets, "home.jpg")
    ImageView1.Gravity = Bit.Or(Gravity.CENTER, Gravity.FILL)
    
    card.initialize("nfc", Activity.GetStartingIntent)
    card.onCreate
    
End Sub

Public Sub Read
    Log("onCreate")
    'card.performTagOperations
End Sub

Sub Activity_Resume
    card.onresume
    If card.Data <> "" Then
        MsgboxAsync( card.Data, "Sectores de Tarjeta")
    End If
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    card.onpause
End Sub
 
Upvote 0
Top