Adding Intent to class in Applozic's Messaging SDK - android

Where should I add the foll.intent
Intent intent = new Intent(this, ConversationActivity.class);
startActivity(intent);
As of now, I've followed Applozic's instructions on github. But I am stuck at this.
I've a MainActivity, ApplozicGcmListenerService Class, GcmInstanceIDListenerService Class,GCMRegistrationUtils Class.

When selecting a contact to chat, you can call the ConversationActivity.java to open the chat window.
For example,
Intent intent = new Intent(this, ConversationActivity.class);
intent.putExtra(ConversationUIService.USER_ID, contact_user_id);
intent.putExtra(ConversationUIService.DISPLAY_NAME, contact_name);
startActivity(intent);

Before starting ConversationActivity intent you need to make sure that you have done the Applozic registration.
Where should I add the following intent?
You can start ConversationActivity intent on click of button or an menu option click as your app use case and it will show the list of conversations you have done so far.
You can check this sample code link and we started the ConversationActivity intent on navigation drawer menu item click

Related

How to clear previously opened activity in Android

Intent intent = new Intent(MainActivity.this, Payment.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Opening coupon activity to apply coupon:
Intent intent = new Intent(Payment.this, Coupon.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
From coupon activity opening payment activity with updated data
Intent intent = new Intent(Coupon.this, Payment.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
The problem is, when I click on the back button on payment activity after applying the coupon, it opens the previously opened payment activity again (not the main activity).
onBackPressed() I don't want to do it static (like Intent intent = new Intent(Payment.this, MainActivity.class); and also don't want to use finish(); in payment activity.
Please help.
You can use FLAG_ACTIVITY_NO_HISTORY when launching the Payment activity.
See: https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_NO_HISTORY
This is a Simple Use case of startActivityForResult don't make it complicated with Intent Flags and launch modes.
Whenever you Open your Activity Coupon just use startActivityForResult and upon applying coupon send the result back to previous Activity (success/failure) or whatever result you want . Then you can change the UI as per the result you got in onActivityResult() .
You can follow How to manage startActivityForResult on Android or the latest way from the doc Getting a result from an activity .

start activity quick but back to desktop

I have a quick click button to start activity by intent in my android application, it succeed to target activity ,but back to the desktop, I can not understand.
please guide me to resolve this.
Intent intent = new Intent(getContext(), ActivityDetailActivity.class);
startActivity(intent);
enter image description here
enter image description here
You need to call intent like this :
Intent intent = new Intent(MainActivity.this, ActivityDetailActivity.class);
startActivity(intent);

How to add paragraphs, images to an android application?

I am creating a simple application for a college. I have added menu items. Now I want to add paragraphs, images to as a new page content on menu click. I have created an intent for the menu item. Now further what to do?
Please help me in doing this.
Use intent to pass to the next activity
Intent intent = new Intent(getApplicationContext(), Yourclass.class);
startActivity(intent);
Use this tutorial http://www.androidhive.info/2011/08/how-to-switch-between-activities-in-android/

Launch CallLog activity in android using Intent

I'm able to launch the Call Log activity using intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(android.provider.CallLog.Calls.CONTENT_URI);
startActivity(intent);
But on selecting any Log (incoming, Outgoing or missed ) from Call Log activity it will initiate a call.
But according to my requirement i want to use above intent using action Intent.ACTION_PICK and startActivityForResult(intent).
please share any idea to do the same.

Accessing Android Inbox/Messaging from Activity?

Is it possible to open up the default Android Messaging activity from inside an activity you write yourself? Like for example: I press a "Mail" button inside my program, and it opens the Android Messaging app just like as if I was to press the Messaging icon on the main screen.
I did something similar to this with the Contacts activity, but only the contact list comes up, no extra functionality like Adding/Modifying/Deleting, etc.
Any ideas?
edit: I found this way to open the "Compose New Message" Activity, I just need to back it up a step. Does anyone know the correct MIME type instead of this one?
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
m_activity.startActivity(sendIntent);
This starts the messaging app from another app:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName("com.android.mms","com.android.mms.ui.ConversationList"));
startActivity(intent);
Just put it inside a button listener or whatever user input you want to open it from.
Enjoy :-)
If you want to open the messaging app to view messages and not for sending a message, this should do the job:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setPackage("com.google.android.apps.messaging");
startActivity(intent);

Categories

Resources