Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7831635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:49:05+00:00 2026-06-02T11:49:05+00:00

I’m currently working on a libproject (Android) that should be included inside a few

  • 0

I’m currently working on a libproject (Android) that should be included inside a few other applications.

Everything is working fine now that I’ve been struggling a bit with Activities and Manifests, exept for the C2DM bit.

I can invoke my different classes fine, but I can’t seem to catch the registration ID (or of course actual messages, but that must be the same problem…)

I think the problem is coming from the filtering in my manifest(s), so if anyone has any advice for me, that would be really helpful.

Here is a copy of receiver part of my manifest (from the apps, not the library, but it’s actually just a copy), but it’s pretty straighforward. I just want to know how I should adapt it in order to invoke the right class in the lib…

        <!--
             Only C2DM servers can send messages for the app. If permission is 
            not set - any other app can generate it
        -->
        <receiver
            android:name="com.google.android.c2dm.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="com.myapp.lib" />
            </intent-filter>
            <!-- Receive the registration id -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.myapp.lib" />
            </intent-filter>
        </receiver>

Where com.myapp.lib is my lib package name, and the receiver is in a package named the same (in the lib project, of course).

Thanks in advance for the help, and don’t hesitate to ask for furthers details 🙂

Edit :
I tried with only the lib registered on google C2DM, and also with both app and lib. Same problem

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:49:07+00:00Added an answer on June 2, 2026 at 11:49 am

    There is a better way of using your C2DM from a library project by using the intent-filter.

    The manifest file is the one from the app.
    The package for the lib is com.mylib and the one for the app is com.myapp.

    There is 2 things to change from the lib manifest.

    1. The classpath used in permissions.
    2. The intent-filter package.

    Both should be you app package and not your lib package.

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myapp"
    android:versionCode="1"
    android:versionName="1.0" >
    
    <permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    
    <uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    
    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
    
         <uses-library android:name="com.google.android.maps" android:required="true"/>
    
    
    
        <activity
            android:name=".MyActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    
    
         <receiver
            android:name="com.mylib.C2DMRegistrationReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" >
                </action>
                <category android:name="com.myapp" /> 
            </intent-filter>
        </receiver>
    
        <receiver
            android:name="com.mylib.C2DMMessageReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" >
                </action>
               <category android:name="com.myapp" /> 
            </intent-filter>
        </receiver>
    </application>
    </manifest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.