在手动启动应用之前不接收推送通知

时间:2013-08-12 21:27:44

标签: android push-notification appcelerator

希望有人可以帮我解决一些棘手的问题。

重点是我有一个基于appcelerator的应用程序,它包含Appcelerator云服务的推送通知服务。当用户手动启动应用程序时,一切都很顺利,即使它转到后台,它也会收到通知。

但是,如果重新启动手机,则不再接收通知。

我不确定这是一个明显的问题还是什么,所以我会发布它。如果您需要任何其他信息,请直接索取!

非常感谢,

哈维尔


清单

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<property name="acs-oauth-secret-production" type="string">XXXXX</property>
<property name="acs-oauth-key-production" type="string">XXXXX</property>
<property name="acs-api-key-production" type="string">XXXXX</property>
<property name="acs-oauth-secret-development" type="string">XXXXX</property>
<property name="acs-oauth-key-development" type="string">XXXXX</property>
<property name="acs-api-key-development" type="string">XXXXX</property>
<id>com.realzaragozasad.android</id>
<name>RealZaragoza</name>
<version>7</version>
<publisher>Real Zaragoza</publisher>
<url>http://www.realzaragoza.com</url>
<description>Aplicación móvil del Real Zaragoza para Android</description>
<copyright>2013 by Real Zaragoza</copyright>
<icon>appicon.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>
<statusbar-hidden>false</statusbar-hidden>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<property name="ti.ui.defaultunit" type="string">system</property>
<iphone>
    <orientations device="iphone">
        <orientation>Ti.UI.PORTRAIT</orientation>
    </orientations>
    <orientations device="ipad">
        <orientation>Ti.UI.PORTRAIT</orientation>
        <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
        <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
        <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
    </orientations>
</iphone>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
    <tool-api-level>8</tool-api-level>
    <manifest android:installLocation="preferExternal"
        android:versionCode="7" android:versionName="1.4">
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
        <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.VIBRATE"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    </manifest>
    <application>
        <service android:name="com.appcelerator.cloud.push.PushService"/>
        <receiver android:name="com.appcelerator.cloud.push.PushBroadcastReceiver" >
          <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="com.appcelerator.cloud.push.PushService.MSG_ARRIVAL" />
            <category android:name="android.intent.category.HOME" />
          </intent-filter>
          <meta-data 
            android:name="com.appcelerator.cloud.push.BroadcastReceiver.ArrivalActivity"
            android:value="com.cocoafish.pushnotifications.ArrivalActivity" />
        </receiver>
    </application>
</android>
<mobileweb>
    <precache/>
    <splash>
        <enabled>true</enabled>
        <inline-css-images>true</inline-css-images>
    </splash>
    <theme>default</theme>
</mobileweb>
<modules>
    <module platform="commonjs">ti.cloud</module>
    <module platform="android">ti.cloudpush</module>
</modules>
<deployment-targets>
    <target device="blackberry">false</target>
    <target device="android">true</target>
    <target device="ipad">false</target>
    <target device="iphone">false</target>
    <target device="mobileweb">false</target>
    <target device="tizen">false</target>
</deployment-targets>
<sdk-version>3.1.0.GA</sdk-version>
</ti:app>

2 个答案:

答案 0 :(得分:0)

我回答我自己的问题,分享知识来解决这个问题,也许对其他人有用。

在我的情况下,问题是我的应用程序安装在外部存储(SD卡)中,这阻止了在设备重新启动时侦听通知的服务。

希望我能帮助别人!

答案 1 :(得分:0)

在设置中查看应用程序管理器中是否启用了应用程序。