Italian Service not work!

Touch

Active Member
Licensed User
Longtime User
Hi!
I have created a service named start:
Code: Copy
'Activity Main
Sub Activity_Create(FirstTime As Boolean)
    StartService(start)
    Activity.Finish
End Sub
Code: Copy
'Module Service
Sub Service_Start (StartingIntent As Intent)
    StartServiceAt("", DateTime.Now + 0.1 * DateTime.TicksPerMinute, False)
End Sub
...
If I install the service everything works.
Then I had the need to hide the icon from the app list,
I made the change with the following code in the manifest
Code: Copy
'Manifest
AddReplacement(android.intent.action.MAIN, unused_action)
with this change, the service is not listed in the background processes
and therefore does not work.

I also tried to enter this code in the manifest
Code: Copy
'Manifest
AddReplacement(android.intent.action.MAIN, unused_action)
<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
But return this error
Code: Copy
Parsing code.                          0.00
Compiling code.                        Error
Error parsing manifest script:
Line = 15, Word = <
Command expected.
At line 15 there is
Code: Copy
<intent-filter>
...
What do you suggest?
 
Non hai inserito il comando, e quindi il programma ti dice che il carattere "<" non è valido.

Devi fare:
Code: Copy
AddReplacement(android.intent.action.MAIN, unused_action)
AddManifestText(
<intent-filter>
 <action android:name="android.intent.action.MAIN"/>
 <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
)

Sergio
 
Last edited:
Non hai inserito il comando, e quindi il programma ti dice che il carattere "<" non è valido.

Devi fare:
Code: Copy
AddReplacement(android.intent.action.MAIN, unused_action)
AddManifestText(
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
)

Sergio
Appena posso provo e ti do conferma!
Grazie
 
Rileggi il mio post precedente, l'ho modificato
Il codice che hai postato non produce errori in compilazione ma il servizio non funziona.
E' come se il servizio non parta neanche. Non viene elencato nei servizi in background.
Se tolgo il codice aggiunto nel manifest, funziona tutto alla perfezione.
Non capisco dove sia il problema!
 
Ho trovato questo esempio, forse ti può essere utile, invece che usare AddManifestText usano AddReceiverText

Sergio

Code: Copy
AddReceiverText(PushService,
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="anywheresoftware.b4a.samples.push" />
</intent-filter>)
 
Ho trovato questo esempio, forse ti può essere utile, invece che usare AddManifestText usano AddReceiverText

Sergio

Code: Copy
AddReceiverText(PushService,
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="anywheresoftware.b4a.samples.push" />
</intent-filter>)
In fase di compilazione mi torna questo errore:
Code: Copy
Parsing code.                          0.02
Compiling code.                        Error
Module: pushservice_br not found.
 
Al posto di PushService penso dovrai mettere il nome del tuo servizio (anzi del Receiver)
 
Al posto di PushService penso dovrai mettere il nome del tuo servizio (anzi del Receiver)
Come in altri casi, Il servizio si avvia e funziona, ma è visibile l'icona nella lista delle app!
 
Back
Top