Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 160
Registered: ‎04-08-2013
My Device: Z10
Accepted Solution

Headless service not working anymore

Hi all!

 

I'm stuck with a problem since few days, the headless part of my app is not started anymore after building and running from Momentics. I already have 3 releases in BlackBerry World working, so I know the code was working previously. I've only made small changes (a few lines) since last release and now, only the UI part is running. I haven't mess with the bar-descriptor.xml lately, and everything in it looks ok to me. 

 

My debug token does include "sys_headless_nostop" and "sys_run_headless".

My app isn't going over the 3mb limit either.

I use 10.2 SDK.

I've already check those threads, but they aren't helping me so far :

http://supportforums.blackberry.com/t5/Native-Development/Headless-app-won-t-start-on-Reset/m-p/2720...

http://supportforums.blackberry.com/t5/Native-Development/recommended-way-to-check-if-HEADLESS-modul...

http://supportforums.blackberry.com/t5/Native-Development/headless-sample-app-not-working/m-p/265291...

http://supportforums.blackberry.com/t5/Native-Development/headless-nostop-auto-start/m-p/2812640/hig...

http://supportforums.blackberry.com/t5/Native-Development/Unable-to-get-headless-apps-working/m-p/26...

 

Any help is appreciated.

 

Thanks!

Roger

 

bar-descriptor.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!-- Copyright (c) 2013 BlackBerry Limited. Licensed
	under the Apache License, Version 2.0 (the "License"); you may not use this
	file except in compliance with the License. You may obtain a copy of the
	License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
	applicable law or agreed to in writing, software distributed under the License
	is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
	KIND, either express or implied. See the License for the specific language
	governing permissions and limitations under the License. -->
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">

	<!-- BlackBerry 10 application descriptor file. Specifies parameters for
		identifying, installing, and launching native applications on BlackBerry
		10. -->

	<!-- A universally unique application identifier. Must be unique across
		all BlackBerry 10 applications. Using a reverse DNS-style name as the id
		is recommended. (Eg. com.example.ExampleApplication.) Required. -->
	<id>com.Alarm2Watch</id>

	<!-- The name that is displayed in the BlackBerry 10 application installer.
		May have multiple values for each language. See samples or xsd schema file.
		Optional. -->
	<name>Alarm2Watch</name>

	<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents
		application version which can be used to check for application upgrade. Values
		can also be 1-part or 2-part. It is not necessary to have a 3-part value.
		An updated version of application must have a versionNumber value higher
		than the previous version. Required. -->
	<versionNumber>1.0.0</versionNumber>

	<!-- Fourth digit segment of the package version. First three segments are
		taken from the <versionNumber> element. Must be an integer from 0 to 2^16-1 -->
	<buildId>5</buildId>

	<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents
		the version of the application, as it should be shown to users. Optional. -->
	<!-- <versionLabel></versionLabel> -->

	<!-- Description, displayed in the BlackBerry 10 application installer.
		May have multiple values for each language. See samples or xsd schema file.
		Optional. -->
	<description>The Alarm2Watch application</description>

	<!-- Copyright information. Optional. -->
	<!-- <copyright></copyright> -->

	<!-- Name of author which is used for signing. Must match the developer
		name of your development certificate. -->
	<author>RogerLeblanc</author>
 <splashScreens>
    <image>background.png</image>
    <image>splash720720.png</image>
    <image>splash7201280.png</image>
    <image>splash1280_768.png</image>
    <image>splash1280_720.png</image>
 </splashScreens>
	<configuration name="Device-Debug">
		<platformArchitecture>armle-v7</platformArchitecture>
		<entryPointType>Qnx/Elf</entryPointType>

		<asset entryPointId="Alarm2Watch" path="arm/o.le-v7-g/Alarm2Watch"
			entry="true" type="Qnx/Elf">Alarm2Watch</asset>
		<asset entryPointId="Alarm2WatchService"
			path="../Alarm2WatchService/arm/Alarm2WatchService"
			type="Qnx/Elf">Alarm2WatchService</asset>
	</configuration>

	<configuration name="Device-Release">
		<platformArchitecture>armle-v7</platformArchitecture>
		<entryPointType>Qnx/Cascades</entryPointType>

		<asset entryPointId="Alarm2Watch" path="arm/o.le-v7/Alarm2Watch.so"
			entry="true" type="Qnx/Cascades">Alarm2Watch.so</asset>
		<asset entryPointId="Alarm2WatchService"
			path="../Alarm2WatchService/arm/Alarm2WatchService"
			type="Qnx/Elf">Alarm2WatchService</asset>
	</configuration>

	<configuration name="Device-Profile">
		<platformArchitecture>armle-v7</platformArchitecture>
		<entryPointType>Qnx/Elf</entryPointType>

		<asset entryPointId="Alarm2Watch" path="arm-p/o.le-v7-g/Alarm2Watch"
			entry="true" type="Qnx/Elf">Alarm2Watch</asset>
		<asset entryPointId="Alarm2WatchService"
			path="../Alarm2WatchService/arm/Alarm2WatchService"
			type="Qnx/Elf">Alarm2WatchService</asset>
	</configuration>

	<configuration name="Simulator-Debug">
		<platformArchitecture>x86</platformArchitecture>
		<entryPointType>Qnx/Elf</entryPointType>

		<asset entryPointId="Alarm2Watch" path="x86/o-g/Alarm2Watch"
			entry="true" type="Qnx/Elf">Alarm2Watch</asset>
		<asset entryPointId="Alarm2WatchService"
			path="../Alarm2WatchService/x86/Alarm2WatchService"
			type="Qnx/Elf">Alarm2WatchService</asset>
	</configuration>

	<entryPoint id="Alarm2Watch">
		<name>Alarm2Watch</name>
	</entryPoint>

	<entryPoint id="Alarm2WatchService">
		<name>Alarm2Watch Service</name>
		<entryPointType>Qnx/Elf</entryPointType>
	</entryPoint>

	<invoke-target id="com.Alarm2WatchService">
		<invoke-target-type>application.headless</invoke-target-type>
		<invoke-target-name>Alarm2Watch Service</invoke-target-name>
		<entry-point-id>Alarm2WatchService</entry-point-id>
		<filter>
			<action>bb.action.system.STARTED</action>
			<mime-type>application/vnd.blackberry.system.event.STARTED</mime-type>
			<property var="uris" value="data&colon;//local" />
		</filter>
		<filter>
			<action>com.Alarm2WatchService.RESET</action>
			<mime-type>*</mime-type>
			<property var="uris" value="headless:" />
		</filter>
	</invoke-target>

	<invoke-target id="com.Alarm2Watch">
		<invoke-target-type>application</invoke-target-type>
		<invoke-target-name>Alarm2Watch</invoke-target-name>
		<icon>
			<image>icon.png</image>
		</icon>
		<entry-point-id>Alarm2Watch</entry-point-id>
	</invoke-target>

	<!-- Unique author ID assigned by signing authority. Required if using debug
		tokens. -->
	<!-- <authorId>ABC1234YjsnUk235h</authorId> -->

	<initialWindow>
		<autoOrients>true</autoOrients>
		<systemChrome>none</systemChrome>
		<transparent>false</transparent>
	</initialWindow>

	<!-- The icon for the application, which should be 114x114. -->
	<icon>
  <image>a2wlogo.png</image>
  <image>a2wlogo94_94.png</image>
	</icon>

	<asset path="icon.png">icon.png</asset>
	<asset path="assets">assets</asset>

	<!-- Locale support -->
	<asset path="translations" dest="qm">
		<include name="*.qm" />
	</asset>
 <asset path="assets/Images/a2wlogo.png">a2wlogo.png</asset>
 <asset path="assets/Images/a2wlogo94_94.png">a2wlogo94_94.png</asset>
 <asset path="assets/Images/appCover.png">appCover.png</asset>
 <asset path="assets/Images/background.png">background.png</asset>
 <asset path="assets/Images/ic_bbm.png">ic_bbm.png</asset>
 <asset path="assets/Images/ic_email.png">ic_email.png</asset>
 <asset path="assets/Images/ic_info.png">ic_info.png</asset>
 <asset path="assets/Images/ic_play.png">ic_play.png</asset>
 <asset path="assets/Images/ic_stop.png">ic_stop.png</asset>
 <asset path="assets/Images/ic_twitter.png">ic_twitter.png</asset>
 <asset path="assets/Images/splash1280_720.png">splash1280_720.png</asset>
 <asset path="assets/Images/splash1280_768.png">splash1280_768.png</asset>
 <asset path="assets/Images/splash720720.png">splash720720.png</asset>
 <asset path="assets/Images/splash7201280.png">splash7201280.png</asset>

	<!-- Request permission to run a backend headless process and post notification. -->
 	<permission system="true">_sys_run_headless</permission>
 	<permission system="true">_sys_headless_nostop</permission> 
	<permission>post_notification</permission>
 <permission>run_when_backgrounded</permission>
	<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib" />
	<env var="CASCADES_THEME" value="dark"/>
</qnx>

 pro file

APP_NAME = Alarm2Watch

LIBS += -lbb -lbbsystem 
CONFIG += qt warn_on cascades10

include(config.pri)

 applicationui.cpp

    bb::system::InvokeRequest request;
	request.setTarget("com.Alarm2WatchService");
	request.setAction("bb.action.system.STARTED");
	request.setMimeType("application/vnd.blackberry.system.event.STARTED");
	m_invokeManager->invoke(request);

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Headless service not working anymore

Welcome to the forums.

Good on you for doing a lot of background research before posting.

 

Did you update to the latest OS version recently, 2141?

Just spitballing but may be relevant.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 160
Registered: ‎04-08-2013
My Device: Z10

Re: Headless service not working anymore

Yes in fact I did. Should I go back to 1925?

 

I might try it, nothing to loose.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Headless service not working anymore

My thoughts as well, worth a try to eliminate that factor.

However I've just checked two headless test apps of mine on the new update and they are starting okay.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Headless service not working anymore

Mind you I haven't rebuild them recently as your OP says, I'll give that a try tomorrow.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 160
Registered: ‎04-08-2013
My Device: Z10

Re: Headless service not working anymore

I've decided to remake the app from the ground up with a new BlackBerry headless app project and copy/paste my code. It worked for about 15 minutes and then back to the same result : the headless part can't be started anymore. I have not downgraded the OS as I don't have enough time to do it during week days, will probably give it a try during the weekend if I can. Here are my logs files : https://db.tt/IHl0pZd5

Forgot to mention, I use QSettings to "communicate" between the 2 parts, don't know if this info is relevant.
Developer
Posts: 160
Registered: ‎04-08-2013
My Device: Z10

Re: Headless service not working anymore

Found the solution, it was in my code :

I've mistakenly deleted the constructor for a QFileSystemWatcher in headless part, so the headless crashed as soon as I called addPath();

 

This is the line that was deleted.

	m_settingsWatcher = new QFileSystemWatcher(this);

 Thanks everyone!