1
嘗試按照教程https://parse.com/tutorials/android-push-notifications添加分析推送通知。使用分析推送通知無法解析方法
當我加入
ParsePush.subscribeInBackground("", new SaveCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
我得到無法解析法 'subscribeInBackground'(java.lang.String中,com.parse.Savecallback)」
請注意,我的應用程序有網頁視圖和Appflood SDK
這裏是我的MainActivity.java
package qax.esouqbahrain;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParsePush;
import com.parse.SaveCallback;
import com.appflood.AppFlood;
import com.appflood.AppFlood.AFEventDelegate;
import com.appflood.AppFlood.AFRequestDelegate;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
ParsePush.subscribeInBackground("", new SaveCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
Parse.initialize(this, "APPID", "KEY");
AppFlood.initialize(this, "cGGxtQU5ULmgDAHO", "MpXlC7mb57d1L54590314", AppFlood.AD_ALL,Color.rgb(224,71,35), Color.rgb(214,214,214),Color.rgb(225,225,225));
//Point to the content view defined in XML
setContentView(R.layout.activity_main);
//Configure the webview setup in the xml layout
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
//Yes, we want javascript, pls.
webSettings.setJavaScriptEnabled(true);
//Make sure links in the webview is handled by the webview and not sent to a full browser
myWebView.setWebViewClient(new WebViewClient());
//And let the fun begin
myWebView.loadUrl("http://esouqbh.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
setDefaultPushCallback不再可用。我必須做什麼 ? – Fakher 2015-09-30 09:20:24
同樣的問題,Parse.initialize()和setDefaultPushCallback不在那裏請幫助我 – Awadesh 2015-11-28 08:46:43