Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Push Up Notifications and Alloy

$
0
0

I have 1 week trying to use push up notifications in an Android App with Alloy, and i can't put it to work, at all. I'm tired of reading the documentation and didn't find an answer

I send a direct notification from my webapp to the cellphone, and it makes and alert, but i can't get the push up notification in the notifications area, and if the app is closed, nothing happens... if the app is in running in background and i send a notification (from my system) the app crashes. And if i try to send the message via Node ACS in My Apps sections didn't work either.

Can you guide me please?.

Here is my main.js

var CloudPush = require('ti.cloudpush');
var deviceToken = null;
 
    // Initialize the module
    CloudPush.retrieveDeviceToken({
        success: deviceTokenSuccess,
        error: deviceTokenError
    });
 
    // Enable push notifications for this device
    // Save the device token for subsequent API calls
    function deviceTokenSuccess(e) {
        deviceToken = e.deviceToken;
    }
    function deviceTokenError(e) {
        alert('Fallo el registro a las push notifications! ' + e.error);
    }
 
    // Process incoming push notifications
    CloudPush.addEventListener('callback', function (evt) {
        alert("Notification received: " + evt.payload);
    });
 
    // These events monitor incoming push notifications
    CloudPush.addEventListener('trayClickLaunchedApp', function (evt) {
        Ti.API.info('Tray Click Launched App (app was not running)');
    });
    CloudPush.addEventListener('trayClickFocusedApp', function (evt) {
        Ti.API.info('Tray Click Focused App (app was already running)');
    });
This is my tiapp.xml
<property name="ti.ui.defaultunit" type="string">dp</property>
    <property name="acs-api-key-development" type="string">rRn25pPe3IbRN2VCPC88jQuhI8O6fR32</property>
    <property name="acs-api-key-production" type="string">kxAn8VnS42fXbk9v1bbzn0DtPiBfk8hZ</property>
    <property name="acs-api-key" type="string">rRn25pPe3IbRN2VCPC88jQuhI8O6fR32</property>
    <property name="acs-grouped-notification-message-development" type="string">Tienes $number$ mensajes sin leer.</property>
    <property name="acs-grouped-notification-message-production" type="string">Tienes $number$ mensajes sin leer.</property>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <!-- Allows the API to download data from Google Map servers -->
            <uses-permission android:name="android.permission.INTERNET"/>
            <!-- Allows the API to cache data -->
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <!-- Use GPS for device location -->
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <!-- Use Wi-Fi or mobile connection for device location -->
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
            <!-- Allows the API to access Google web-based services -->
            <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
            <!-- Specify OpenGL ES 2.0 as a requirement -->
            <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
            <!-- Replace <com.domain.appid> with your application ID -->
            <uses-permission android:name="com.gearsoft.lalosbbq.permission.MAPS_RECEIVE"/>
            <permission
                android:name="com.gearsoft.lalosbbq.MAPS_RECEIVE" android:protectionLevel="signature"/>
            <application>
                <!-- Replace "PASTE YOUR GOOGLE MAPS API KEY HERE" with the Google API key you obtained -->
                <meta-data
                    android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCrzV_vPX9z-6qakwDGPGGZ7oO0ijP4zP0"/>
            </application>
        </manifest>
    </android>
My Apps configuration

![alt text](http://s7.postimg.org/z28wflvbf/android_ACS.png "NodeACS")


Viewing all articles
Browse latest Browse all 8068

Trending Articles