2

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

两种设备之间的唯一区别是,一台(工作的)仅通过 Eclipse 和 Android Studio 的本地构建接收应用程序,而另一台(存在上述问题的设备)从本地构建和 TestFlight 接收应用程序(http://testflightapp.com构建管理服务)。

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

日志猫

在 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>
4

0 回答 0