Android Question Manifest in Library?

qsrtech

Active Member
Licensed User
Longtime User
I'm creating a "push" library with the service (i.e. callback) in it. How can you include the required manifest additions? I ended up adding the "permissions" to a test project and it removed the security error unfortunately it doesn't look like the service in the library is being called back. I also tried to include the full manifest additions in the test project and it seems to give me an error "Module: pushservice_br not found" note my service name is "PushService"

here's the test project's manifest additions:
Code: Copy
AddManifestText(<permission android:name="$PACKAGE$.permission.C2D_MESSAGE" android:protectionLevel="signature" />)
AddPermission($PACKAGE$.permission.C2D_MESSAGE)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
' Push Service Receiver Attribute
SetReceiverAttribute(PushService, android:permission, "com.google.android.c2dm.permission.SEND")
' Service Receiver Text
AddReceiverText(PushService,
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE$" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="$PACKAGE$" />
</intent-filter>)

SOLVED:
Don't need/can't use manifest in Library (at least for permissions and Recievers).
Need to include library package name in front of service in final apps manifest, i.e.
Code: Copy
SetReceiverAttribute(library.package.PushService, android:permission, "com.google.android.c2dm.permission.SEND")
 
Last edited:
looks like a push "library" might not be that feasible since the app needs to be foreground or have a service running all the time which the "library" can call so it's kinda not worth having a library dependent on another service always running unless I can build an "intent" system that starts the app so it look like at this time it will have to be kept as "modules" vs being a library for the mean time.
 
Upvote 0
The library works and receives the messages fine. Maybe my framework is flawed. Basically I have the service that received the GCM intents. I have a class that the app implements to interface with the service, i. E. Register, receive/raise events. When I try to raise an event in the class with callsubdelayed, the activity doesn't get brought forward so it only receives the event when the activity is manually brought forward. Again everything works fine when the activity is in the foreground when a message arrives. Any suggestions?
 
Upvote 0
CallSubDelayed will not start the activity if there is no active activity (by design). The message is queued instead.

Just call StartActivity if you want to force the activity to start. Note that it will be a confusing interface as the activity will jump from nowhere... It will be better to show a notification icon.
 
Upvote 0
On my note2 start activity does nothing. It's a reusable class library so I need it to raise an event and let the owner decide what to do with it. Typically I personally use notifications most of the time, however I do use it to control a app's as well. In this (control app) scenario they(apps) would typically always be foreground anyways, and if not it would probably be fine if it ran once it become active. But again, I would need to let the class owner decide. Basically the goal of the lib was to create a very simple, but advanced push implementation, at least on the reg/receiving side.
 
Upvote 0
Back
Top