Jump to content

Problemas con Parse y android


Recommended Posts


Hola a todos espero que esten bien icon_sad.gif estoy probando como funciona parse asi que hice una pequeña app el problema es que puedo mandar mensajes desde la pagina a los dispositivos pero no de dispositivos a dispositivos y nose que puede ser, puse los ID correspondientes que me da parse pero nada icon_sad.gif

 

Como dije puedo recibir mensajes desde la pagina pero no puedo enviar desde los dispositivos. Espero alguien me pueda ayudar gracias icon_sad.gif

 

Les dejo los codigos icon_sad.gif

 

MainActivity:

public class MainActivity extends ActionBarActivity {

    static Button boton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        boton=(Button)findViewById(R.id.enviar);
        boton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ParsePush push=new ParsePush();
                push.setChannel("canal1");
                push.setMessage("Hola mundo nuevamente :P");
                push.sendInBackground();
                Toast toast=Toast.makeText(getApplication(),"Mensaje",Toast.LENGTH_SHORT);
                toast.show();
            }
        });
    }

Aplication:

public class AplicacionPush extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this, "[Application ID]",
                "Client Key");
        ParseInstallation.getCurrentInstallation()
                .saveInBackground();
        ParsePush.subscribeInBackground("canal1");
    }
}

Mainfest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.cristobal.pruebas" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission android:protectionLevel="signature"
        android:name="com.example.cristobal.pruebas.permission.C2D_MESSAGE" />

    <uses-permission
        android:name="com.example.cristobal.pruebas.permission.C2D_MESSAGE" />

    <application
        android:name="com.example.cristobal.pruebas.AplicacionPush"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


        <service android:name="com.parse.PushService" />
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.ParsePushBroadcastReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.example.cristobal.pruebas" />
            </intent-filter>
        </receiver>
    </application>
</manifest>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...