I am new to android. I ran into the deprecated method problem in push service using parse services. I came across a similar question for a similar problem, but cannot solve the problem. In My main application class I am dealing with this problem, the code is below for this.
public class MApplication extends Application { private static MApplication mInstance; @Override public void onCreate() { super.onCreate(); mInstance = this; Parse.initialize(this, JNI.stringFromJNI001(), JNI.stringFromJNI010());
In my manifest I use this:
<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>
From this link https://teamtreehouse.com/forum/app-crash-on-push-test I saw that I should use it as the next method, but I cannot figure out how to use this and solve my problem.
public class Receiver extends ParsePushBroadcastReceiver { @Override public void onPushOpen(Context context, Intent intent) { Intent i = new Intent(context, MainActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } }
Please help me with this problem. You will be very grateful.
source share