Java Question [Solved] Manifest

Johan Schoeman

Expert
Licensed User
Longtime User
Need some advice on this. I have a Java project Manifest files that has the following:
B4X:
<activity
            android:name="com.qs.acivity.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.qs.acivity.NfcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.PrintActivity" android:screenOrientation="portrait" />
        <activity android:name="com.qs.acivity.PsamActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.IcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.ScanActivity" android:screenOrientation="portrait"/>
         <activity android:name="com.qs.acivity.PosUpdateActivity" android:screenOrientation="portrait"/>

        <!-- 按键广播 -->
      <!--   <receiver
            android:name="com.qs.service.RemoteControlReceiver"
            android:permission="ismart.intent.scandown" >
                <intent-filter android:priority="1000" >

                <action android:name="ismart.intent.scandown" />
            </intent-filter>
        </receiver> -->
        <!-- 广播接收 -->
        <receiver android:name="com.qs.service.StartReceiver" >
            <intent-filter android:priority="996" >
                <action android:name="android.intent.action.BOOT_COMPLETED" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>
        <!-- 扫描服务 -->
        <service android:name="com.qs.service.ScanService" >

        </service>

I have added the above in my B4A project's manifest as follows:
B4X:
AddApplicationText(<activity
            android:name="com.qs.acivity.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            >
        </activity>
        <activity android:name="com.qs.acivity.NfcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.PrintActivity" android:screenOrientation="portrait" />
        <activity android:name="com.qs.acivity.PsamActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.IcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.ScanActivity" android:screenOrientation="portrait"/>
         <activity android:name="com.qs.acivity.PosUpdateActivity" android:screenOrientation="portrait"/>

         <receiver android:name="com.qs.service.StartReceiver" >
            <intent-filter android:priority="996" >
                <action android:name="android.intent.action.BOOT_COMPLETED" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>

        <service android:name="com.qs.service.ScanService" >

        </service>)

Is this correct or am I missing something?
 

Johan Schoeman

Expert
Licensed User
Longtime User
The complete original Manifest looks like this:
B4X:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.qs.demo3506"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.NFC" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name="com.qs.wiget.App"
        android:allowBackup="true"
        android:icon="@drawable/pos_ico"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.qs.acivity.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.qs.acivity.NfcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.PrintActivity" android:screenOrientation="portrait" />
        <activity android:name="com.qs.acivity.PsamActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.IcActivity" android:screenOrientation="portrait"/>
        <activity android:name="com.qs.acivity.ScanActivity" android:screenOrientation="portrait"/>
         <activity android:name="com.qs.acivity.PosUpdateActivity" android:screenOrientation="portrait"/>

        <receiver android:name="com.qs.service.StartReceiver" >
            <intent-filter android:priority="996" >
                <action android:name="android.intent.action.BOOT_COMPLETED" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>
        <service android:name="com.qs.service.ScanService" >

        </service>
    </application>

</manifest>

I have added the permissions in the wrapper.

But I get this error and not sure if it is related to the B4A Manifest that I have created:
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.posapi.PosApi.gpioControl(byte, int, int)' on a null object reference
    at com.qs.service.ScanService.openDevice(ScanService.java:154)
    at com.qs.service.ScanService.access$1(ScanService.java:152)
    at com.qs.service.ScanService$3.run(ScanService.java:192)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:5737)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…