Kuraturpa / titanium-c2dm

C2dm push notifications for titanium-mobilesdk 1.8.0.1
Other
18 stars 3 forks source link

Intent error #1

Closed rborn closed 12 years ago

rborn commented 12 years ago

Hi, sorry to contact you like this. I managed to build the module with Ti SDK 2.0 but I get this error:


02-21 18:06:22.460: W/ActivityManager(2820): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION cat=[com.c2dm] flg=0x10 cmp=com.c2dm/com.findlaw.c2dm.C2DMReceiver (has extras) }: not found

I have android sdk set to 8, and I test on device so it should work. Any idea what it could be? Thnx

Kuraturpa commented 12 years ago

Hi Do you have Market installed on test device? You also need Google APIs for android. Thanks

rborn commented 12 years ago

I have google market on devices of course and the APIs in the SDK. Is there any setting I have to make in tiapp.xml or whatever to compile with APIs SDK ?

Thnx.

Kuraturpa commented 12 years ago

Do you have all permissions set in tiapp.xml and timodule.xml?

rborn commented 12 years ago

I believe so. There is no complain related to permissions.

timodule.xml when compiling the module, right?

I installed the module in the normal place (/Library/Application\ Support/Titanium/modules/android/com.findlaw.c2dm/)

I also have a custom AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.c2dm"
      android:versionCode="1"
      android:versionName="1"
>
    <uses-sdk android:minSdkVersion="8" />

    <supports-screens 
        android:smallScreens="false"
        android:normalScreens="true"
        android:largeScreens="true"
        android:anyDensity="false"
    />

    <application
        android:icon="@drawable/appicon"
        android:label="c2dm"
        android:name="C2dmApplication"
        android:debuggable="false"
    >
        <activity
            android:name=".C2dmActivity"
            android:label="c2dm"
            android:theme="@style/Theme.Titanium"
            android:configChanges="keyboardHidden|orientation"
        >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="org.appcelerator.titanium.TiActivity"
            android:configChanges="keyboardHidden|orientation"
        />
        <activity android:name="org.appcelerator.titanium.TiModalActivity"
            android:configChanges="keyboardHidden|orientation"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
        />
        <activity android:name="ti.modules.titanium.ui.TiTabActivity"
            android:configChanges="keyboardHidden|orientation"
        />
        <activity android:name="ti.modules.titanium.media.TiVideoActivity"
            android:configChanges="keyboardHidden|orientation"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        />

        <service
            android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"
            android:exported="false"
        />

        <service android:name=".C2DMReceiver" />

        <!-- Only google service can send data 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.findlaw.c2dm" />
            </intent-filter>
            <!-- Receive the registration id -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.findlaw.c2dm" />
            </intent-filter>
        </receiver>

    </application>

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    <uses-permission android:name="com.google.android.c2dm.permission.REGISTRATION"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.findlaw.c2dm.permission.C2D_MESSAGE" />

    <permission android:name="com.findlaw.c2dm.permission.C2D_MESSAGE" android:protectionLevel="signature" />

</manifest>

tiapp.xml :

    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <tool-api-level>8</tool-api-level>
        <manifest>
            <permission android:name="com.c2dm.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
            <uses-permission android:name="com.c2dm.permission.C2D_MESSAGE"/>

            <uses-permission android:name="android.permission.USE_CREDENTIALS" />
            <uses-permission android:name="android.permission.WAKE_LOCK" />

            <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
            <uses-permission android:name="com.google.android.c2dm.permission.REGISTER"/>
            <uses-permission android:name="android.permission.WAKE_LOCK"/>

            <application>
                <service android:name="com.c2dm.C2DMReceiver"/>
                <receiver
                    android:name="com.google.android.c2dm.C2DMBroadcastReceiver" 
                        android:permission="com.google.android.c2dm.permission.SEND">
                    <intent-filter>
                        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                        <category android:name="com.c2dm"/>
                    </intent-filter>
                    <intent-filter>
                        <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
                        <category android:name="com.c2dm"/>
                    </intent-filter>
                </receiver>
            </application>
        </manifest>
    </android>

Thank you.

Kuraturpa commented 12 years ago

Try to change this:```

to this:```
<service android:name="com.findlaw.c2dm.C2DMReceiver"/>
```on tiapp.xml
rborn commented 12 years ago

Holly Shmolly , you are a God :)

02-21 21:03:58.898: I/TiAPI(716): JS registration success event: APA91bFH....blahblah...

I'll run more tests and let you know. Thanks a lot.