[Mono-bugs] [Bug 665840] New: Need a macro to replace tokens in attribute string constants (eg: __PackageName__ )

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 20 08:59:02 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=665840

https://bugzilla.novell.com/show_bug.cgi?id=665840#c0


           Summary: Need a macro to replace tokens in attribute string
                    constants (eg: __PackageName__ )
    Classification: Mono
           Product: MonoDroid
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: mkestner at novell.com
        ReportedBy: jondick at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10

Here's the scenario.  For C2DM, I need to generate a manifest like this:
<!-- Only C2DM servers can send messages for the app. If permission is not set
- any other app can generate it -->
        <receiver android:name="{YOUR.PACKAGE}.C2dmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
            <!-- Receive the actual message -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE"
/>
                <category android:name="{YOUR.PACKAGE}" />
            </intent-filter>
            <!-- Receive the registration id -->
            <intent-filter>
                <action
android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="{YOUR.PACKAGE}" />
            </intent-filter>
        </receiver>

So, in the code I can use attributes to do most of this:
[BroadcastReceiver(Permission="com.google.android.c2dm.permission.SEND")]
[IntentFilter(new string[] { "com.google.android.c2dm.permission.RECEIVE",
"com.google.android.c2dm.intent.REGISTRATION" }, 
    Categories=new string[]{ "__PackageName__" })]
public class C2dmBroadcastReceiver : BroadcastReceiver
{
    ...
}


However note that i put __PackageName__ as the category.  I need to somehow
have this automatically replaced with the real package name.  I realize I could
type in the string manually, however I'm using this for my C2DM-Sharp library,
and I won't know the package name at this point (this is a MonoDroid Library,
so ideally the __PackageName__ gets replaced with the package name of the app
which is referencing this library).

Reproducible: Always

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list