Android上的Phonegap:点按时推送通知不执行任何操作

时间:2013-12-25 01:30:00

标签: android cordova push-notification testflight pushwoosh

我安装了两台安装了相同应用程序的设备(PhoneGap 2.5.0,Android SDK min 11,target 19)。一个工作完美,另一个工作有以下问题:我向所有设备发送推送通知(通过PushWoosh,http://pushwoosh.com/类似于Urban Airship),我的设备都收到了它,但是在有问题的设备上,当应用程序不在前台,我从托盘中点击通知,通知被解除,但应用程序没有返回到前台。

两个设备之间的唯一区别是,一个(工作的)只通过Eclipse和Android Studio的本地构建接收了应用程序,而另一个(具有上述问题的那个)已经从本地接收了应用程序build和TestFlight(http://testflightapp.com构建管理服务)。

我尝试在工作设备上通过TestFlight安装应用程序,现在该设备出现了同样的问题。我尝试卸载TestFlight和我的应用程序,然后从Android Studio构建到每个设备,但问题仍然存在。

logcat的

在Android Studio中,只要点击通知,logcat就会告诉我以下内容:

12-24 17:01:25.152     780-1032/? I/ActivityManager﹕ START u0 {flg=0x24000000 cmp=com.markon.markon/com.arellomobile.android.push.PushHandlerActivity bnds=[0,153][1080,351] (has extras)} from pid -1
12-24 17:01:25.152     780-1032/? W/ActivityManager﹕ Permission Denial: starting Intent { flg=0x24000000 cmp=com.markon.markon/com.arellomobile.android.push.PushHandlerActivity bnds=[0,153][1080,351] (has extras) } from null (pid=-1, uid=10207) not exported from uid 10217
12-24 17:01:25.172     780-1032/? W/ActivityManager﹕ Unable to send startActivity intent
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x24000000 cmp=com.markon.markon/com.arellomobile.android.push.PushHandlerActivity bnds=[0,153][1080,351] (has extras) } from null (pid=-1, uid=10207) not exported from uid 10217
        at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1186)
        at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:741)
        at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:3300)
        at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:252)
        at com.android.server.am.PendingIntentRecord.send(PendingIntentRecord.java:192)
        at android.content.IIntentSender$Stub.onTransact(IIntentSender.java:64)
        at android.os.Binder.execTransact(Binder.java:404)
        at dalvik.system.NativeStart.run(Native Method)

与TestFlight可能相关的问题

在我卸载TestFlight之前,PushWoosh的设备注册是奇怪的。我构建了一个设置页面,用户可以选择加入/退出推送通知,这些通知会调用PushWoosh中的相关服务。 Logcat表示呼叫正确发生,甚至还没有成功回调,但设置从未停止过。如果我选择(设备已注册)并且我选择退出,那么PushWoosh将通过logcat报告呼叫成功,但注册设备的数量不会更新,推送通知仍然会通过。相反(选择退出,然后尝试选择加入)以同样的方式失败。

一旦我卸载了TestFlight,我的应用程序并重新安装了我的应用程序,注册/取消注册我的设备的服务调用就完美无缺。但是,即使在此之后,点击推送通知也会以相同的方式失败。我无法弄清楚如何完全“重置”我的手机以恢复之前的状态(一切都与推送通知有关)。

的AndroidManifest.xml

我认为没有关系,因为我没有在一切运作良好和问题开始之间修改清单。包括以防万一。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.markon.markon"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

<compatible-screens></compatible-screens>
    <supports-screens 
    android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:resizeable="true" 
    android:anyDensity="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

<!-- start pushwoosh needs -->
<!--library-->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<!--
Creates a custom permission so only this app can receive its messages.

NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
    where PACKAGE is the application's package name.
-->
<permission
     android:name="com.markon.markon.permission.C2D_MESSAGE"
     android:protectionLevel="signature"/>
<uses-permission
     android:name="com.markon.markon.permission.C2D_MESSAGE"/>

<!-- This app has permission to register and receive data message. -->
<uses-permission
     android:name="com.google.android.c2dm.permission.RECEIVE"/>
<!-- end pushwoosh needs -->


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Markon"
            android:label="@string/title_activity_markon"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
            android:screenOrientation="portrait"
            android:launchMode="singleTop" >
            <!-- for pushwoosh -->
            <intent-filter>
                <action android:name="com.markon.markon.MESSAGE"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- for pushwoosh -->
        <activity android:name="com.arellomobile.android.push.PushWebview"/>
        <activity android:name="com.arellomobile.android.push.MessageActivity"/>
        <activity android:name="com.arellomobile.android.push.PushHandlerActivity"/>

        <!--
          BroadcastReceiver that will receive intents from GCM
          services and handle them to the custom IntentService.
         
          The com.google.android.c2dm.permission.SEND permission is necessary
          so only GCM services can send data messages for the app.
        -->
        <service android:name="com.arellomobile.android.push.PushGCMIntentService"/>
        <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <action android:name="android.intent.action.USER_PRESENT" />

                <category android:name="com.markon.markon"/>
            </intent-filter>
        </receiver>
         
        <!--
          Application-specific subclass of PushGCMIntentService that will
          handle received messages.
        -->
        <!-- <service android:name="com.arellomobile.android.push.GeoLocationService"/> -->

    </application>

</manifest>

0 个答案:

没有答案