Java Question Another Manifest confirmation

Johan Schoeman

Expert
Licensed User
Longtime User
Really battling with a shortcut wrap that I am trying do to before attempting the B4A wrapper. First need to understand the code and what it does when. The Java code complies 100% and then I purely try and kick start the external activity from within B4A (done this many time before without a problem). The project that I am trying to kick start at present has a Manifest file that looks as follows:

B4X:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myscandemo"
    android:versionCode="4"
    android:versionName="4.1" >

    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="19" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_MTK_MMHW" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/scan_logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
       
       <!-- receive funkey -->
        <receiver android:name="com.rfid.scan.KeyReceiver">
            <intent-filter>
                <action android:name="android.rfid.FUN_KEY"/>
                <!-- 兼容H941 -->
                <action android:name="android.intent.action.FUN_KEY"/>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>
        <!-- config settings action android:name="com.rfid.scan.config" <data android:scheme="com.rfid.scan" android:host="ConfigActivity"/> -->
        <activity android:name="com.rfid.scan.ConfigActivity"
            android:launchMode="singleTask">
                        <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
               
                  <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           
        </activity>
       
        <service android:name="com.rfid.scan.service.ScanService">
                     <intent-filter>
                <action android:name="com.scan.service" /> 
                <category android:name="android.intent.category.DEFAULT" /> 
            </intent-filter>
        </service>
    </application>

</manifest>

My B4A project's Manifest looks as follows:

B4X:
'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="17" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

AddApplicationText(<receiver android:name="com.rfid.scan.KeyReceiver">
            <intent-filter>
                <action android:name="android.rfid.FUN_KEY"/>
                <action android:name="android.intent.action.FUN_KEY"/>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>
        <!-- config settings action android:name="com.rfid.scan.config" <data android:scheme="com.rfid.scan" android:host="ConfigActivity"/> -->
        <activity android:name="com.rfid.scan.ConfigActivity"
            android:launchMode="singleTask">
           
        </activity>
       
        <service android:name="com.rfid.scan.service.ScanService">
                     <intent-filter>
                <action android:name="com.scan.service" /> 
                <category android:name="android.intent.category.DEFAULT" /> 
            </intent-filter>
        </service>)

I have the following permissions added in the shortcut wrapper (so, that should take care of the required permissions as per original Java project's Manifest):
B4X:
@Permissions(values={"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.CAMERA", "android.permission.ACCESS_MTK_MMHW"})

The compiled B4A project's manifest looks as follows (from the /Objects folder of the B4A project):
B4X:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="JHS.Scan2DServer"
    android:versionCode="1"
    android:versionName=""
    android:installLocation="internalOnly">
   
    <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
    <supports-screens android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.ACCESS_MTK_MMHW"/>
    <application
        android:icon="@drawable/icon"
        android:label="b4aScan2DServer">
       
        <receiver android:name="com.rfid.scan.KeyReceiver">
                    <intent-filter>
                        <action android:name="android.rfid.FUN_KEY"/>
                        <action android:name="android.intent.action.FUN_KEY"/>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </receiver>
                <!-- config settings action android:name="com.rfid.scan.config" <data android:scheme="com.rfid.scan" android:host="ConfigActivity"/> -->
                <activity android:name="com.rfid.scan.ConfigActivity"
                    android:launchMode="singleTask">
                   
                </activity>
               
                <service android:name="com.rfid.scan.service.ScanService">
                             <intent-filter>
                        <action android:name="com.scan.service" /> 
                        <category android:name="android.intent.category.DEFAULT" /> 
                    </intent-filter>
                </service>
        <activity
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".main"
            android:label="b4aScan2DServer"
            android:screenOrientation="unspecified">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           
        </activity>
        <service android:name=".starter">
        </service>
        <receiver android:name=".starter$starter_BR">
        </receiver>
    </application>
</manifest>

But the laser scanner on the handheld device does not what to start (and I don't have one - I am doing this blind for someone else). No error. Just don't want to start the laser scanner....

The original app (probably installed via an APK) on the device does however work. All that I have done was to convert 2 x *.aidl files to java code and then compiled the java project into a jar and then trying to kick start it from within B4A.

Sorry to ask the same stupid question once again - but is my conversion of the original manifest to my B4A manifest correct (and then the subsequent manifest created when compiling the B4A project)?

Thanks

Johan.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Looks correct. Have you checked the unfiltered logs for any errors?
Erel, it seems as if the problem is somewhere in the lib that I am wrapping. I have tracked it down to a driver that does not get initialized and the driver must be sitting in one of the .so files. But I don't have a physical device with me so a bit difficult to get it sorted out. Code is now strewn with log statements and that is how I found the problem. The person I am doing this wrap for has send me the B4A log.

Bit thanks for info above. At least then the Manifest is correct.
 
Top