Android Question Extra Information on AndroidManifest.xml

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Hey Everybody,

Anybody know to implement in manifest (THROUGHT B4A of course) this code below?

My problem is when I create a voice command in GOOGLE GLASS and I need to put this to work, and I need to put directly in Androidmanifest.xml (in OBJ Folder) and put like READ ONLY to B4A not change anything.



<service android:name=".listentrigger">
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger_start" />
</service>

<receiver android:name=".listentrigger$listentrigger_BR">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
<intent-filter><action android:name="com.google.android.glass.action.VOICE_TRIGGER" /></intent-filter>
</receiver>
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Erel,

Can I change a resource inside a AndroidManifest.xml direcly to a text? like this example:

original way

android:resource="@xml/voice_trigger_start"



Can I change for this?

android:resource="is just an example"


assuming in my example the Objects\res\xml\voice_trigger_start.xml" (inside in this file = <trigger keyword="@string/start_stopwatch" />"
and inside the fileObjects\res\values\strings.xml

<resources>
<string name="start_stopwatch">is just an example</string>
</resources>
 
Upvote 0

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Erel,

The AddApplicationText is duplicating the Services, look my example:

I have a service called : ListenTrigger (Used by Google Glass to receive the Vocal Command after "OK GLASS"
but when I put the code with AddApplicationText in Manifest Editor, when I compile the source code, the service is duplicating in androidmanifest.xml, take a look:


In Green, is the code I put with AddApplicationText
In Red, is the code the B4A put automatically.

Question: have any command to IGNORE this automatically creation? Or another way to do this correctly?



<application
android:icon="@drawable/icon"
android:label="Glass Photo">

<service android:name=".listentrigger">
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger_start" />
</service>
<receiver android:name=".listentrigger$listentrigger_BR">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
<intent-filter><action android:name="com.google.android.glass.action.VOICE_TRIGGER" /></intent-filter>
</receiver>

<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".main"
android:label="Glass Photo"
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=".listentrigger">
</service>
<receiver android:name=".listentrigger$listentrigger_BR">
</receiver>

<service android:name=".recognizerservice">
</service>
<receiver android:name=".recognizerservice$recognizerservice_BR">
</receiver>
</application>
 
Upvote 0

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Erel,

Look this part of manifest:


<service android:name=".listentrigger">
android:enabled="true" android:exported="true">
<intent-filter><action android:name="com.google.android.glass.action.VOICE_TRIGGER"/></intent-filter>
<meta-data android:name="com.google.android.glass.VoiceTrigger" android:resource="@xml/voice_trigger" />
</service>


In this resource (@xml/voice_trigger) I have:

<trigger keyword="@string/voicetrigger" />

and in strings.xml
i have

<resources>
<string name="voicetrigger">any text</string>
</resources>



BUT I NEED ALWAYS leave the RES folder in READONLY to B4A not delete..


Can I do any changes to do this ONLY in Manifest Editor, without use the RES FOLDER?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to go over the the manifest editor tutorial. It provides all the methods needed to add text anywhere you like. You do not need to use AddReplacement.

The res folder has nothing to do with the manifest editor. You can use #AdditionalRes to define another folder as the resource folder. Files in that folder will not be deleted.
 
Upvote 0
Top