Created
June 13, 2013 18:12
-
-
Save anonymous/5775986 to your computer and use it in GitHub Desktop.
Adicionando Parse em projeto Android com Phonegap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, | |
software distributed under the License is distributed on an | |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, either express or implied. See the License for the | |
specific language governing permissions and limitations | |
under the License. | |
*/ | |
package br.com.app; | |
/* | |
1 - Fazer o download do SDK do Parse | |
2 - Extrair os arquivos para a pasta libs do seu projeto | |
3 - Import dos pacotes para a Activity | |
4 - Inicializar o Parse no método onCreate | |
*/ | |
import android.os.Bundle; | |
import org.apache.cordova.*; | |
/* Pacotes importados do Parse | |
import com.parse.Parse; | |
import com.parse.ParseInstallation; | |
import com.parse.PushService; | |
public class MainActivity extends DroidGap | |
{ | |
@Override | |
public void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
super.setIntegerProperty("splashscreen", R.drawable.splash); | |
super.loadUrl(Config.getStartUrl(), 20000); | |
/* Inicialização do Parse */ | |
Parse.initialize(this, "app_id", "client_key"); | |
ParseInstallation.getCurrentInstallation().saveInBackground(); | |
PushService.setDefaultPushCallback(this, MainActivity.class); | |
PushService.subscribe(this, "", MainActivity.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment