need help developing SMS and MMS application

Put your problem here if it does not fit any of the other categories.

Re: need help developing SMS and MMS application

Postby kashifmehmood » Wed Feb 22, 2012 6:42 am

HI Phyll

i ma talking about my own app...

i think i should some kind of array or list view to store sms??

Regards.

kashif
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Top

Re: need help developing SMS and MMS application

Postby Phyll » Wed Feb 22, 2012 12:15 pm

Hi kashif,

I think you need to store them in a file so that you can retrieve them when you start the app again. You would only delete them when the user wanted to. Say a menu item or something.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Thu Feb 23, 2012 1:51 pm

HI Phyll,,

i am talking about my application...
i figured out how to display the message but it also gives error...

public class SMSReceiver extends BroadcastReceiver {


@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
//---get the SMS message passed in---
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
if (bundle != null)
{
//---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
str += "SMS from " + msgs[i].getOriginatingAddress();
str += " :";
str += msgs[i].getMessageBody().toString();
str += "\n";
}
//---display the new SMS message---
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}
}
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Thu Feb 23, 2012 1:51 pm

02-16 05:47:09.752: E/AndroidRuntime(514): Caused by: java.lang.ClassNotFoundException: sms.app.SMSReciever in loader dalvik.system.PathClassLoader[/data/app/sms.app-2.apk]

this error is displayed in the stack trace,,
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Re: need help developing SMS and MMS application

Postby Phyll » Thu Feb 23, 2012 2:45 pm

Hi Kashif,

I was looking for places in that code where it might look for a class. It looks like it can't find that class in the first place. I think its because it is mispelled in the manifest.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Fri Feb 24, 2012 12:23 pm

HI Phyll,

<receiver android:name=".SMSReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>

u c its named exactly the same in manifest but dont y it cant find it...

Kashif
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Top

Re: need help developing SMS and MMS application

Postby Phyll » Fri Feb 24, 2012 12:54 pm

Hi kashif,

The reason I said that is because its misspelled here in the error. You must have copied that by hand, huh?

02-16 05:47:09.752: E/AndroidRuntime(514): Caused by: java.lang.ClassNotFoundException: sms.app.SMSReciever in loader dalvik.system.PathClassLoader[/data/app/sms.app-2.apk]

Anyway, I guess you have the right permissions.

About that error, it seems to be looking for sms.app in the sms.app-2.apk. If this is in the emulator or even in your phone, I think you should see if you have two apps with nearly the same name or the same name installed with slightly different features and enough of the same parts to confuse the OS. Especially on the emulator. I have seen that happen when making a lot of edits.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Fri Feb 24, 2012 6:06 pm

Hi Phyll,,,

It helped...there were two applications of the same name....

but i got another problem...
I settled up all the notifications of the sms and it works fine but when i pull down the notification and when i click on it nothing happens...

how can i make it to open that chat ...
and so far i have been unable to store the sms :(
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Re: need help developing SMS and MMS application

Postby Phyll » Fri Feb 24, 2012 10:05 pm

Hi Kashif,

Well it doesn't look like your receiver is creating the notification intent, so where is that being done? I was kind of thinking that all that is done somewhere before the broadcast is even made.

If you have the message in your receiver and can use it for the toast, you can easily send it to a file, or put it in an SQLite data base. In the data base it would be easy to pull all the records belonging to a certain number probably. You could also send off your own intent, but I haven't thought about what you could do with any pending ones.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Sat Feb 25, 2012 9:11 am

Hi Phyll
have a look at this code..

Notification notification = new Notification(icon, tickerText, when);
CharSequence contentTitle = from;
CharSequence contentText = sb.toString();
Intent notificationIntent = new Intent(context,SMS.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
// notification.vibrate = new long[] { 100, 250, 100, 500};
notification.flags |= Notification.FLAG_AUTO_CANCEL;

nm.notify(1, notification);

notification works fine and i have been able to click on notification and open my main sms sending class but still cant figureout how to restore the chat wid the same number...

Regards
Kashif
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Re: need help developing SMS and MMS application

Postby Phyll » Sat Feb 25, 2012 12:06 pm

Hi Kashif,

See if this is the same problem:

other-coding-problems-f5/start-default-sms-app-problem-t535081.html

See if his solution will work for you in your pending intent.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Tue Feb 28, 2012 5:11 pm

Hi Phyll

that helped a lot...
now trying to save the sms and figure out a way to restore it the maain menu of the application...

Regards...
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Re: need help developing SMS and MMS application

Postby hgft » Wed Feb 29, 2012 10:00 am

Coach Outlet Online Sale is with imperfections which consist of cuts, scars, and scratches will exist, the grain in its organically grown problem has between one of the most considerable dietary fibers strength, and getting a last end result between one of the most considerable durability. The grain also has organically grown breathability, resulting in increased comfort using the path from the wearer.

Louis Vuitton Outlet could possibly be one of the most well-known is not necessarily one of the most ideal for you! possibly the most current quarter round shoulder bag with fluorescent color provides you a shine in the moment, desire to possess the urge to it immediately; But possibly your pores and skin color could possibly be the earth beside the handbag could possibly be one of the most make you fondle admiringly joker choice.

Louis Vuitton Outlet supply reduce, the weakening from the role, tiny haystack in slender whole body once more and again. the right way to purchase Louis Vuitton bags That's between the powerful cohesion when Cunningham lancelet find yourself isolated point, allow wind and bad weather insulation, yr pursuing year, pile of grass system earlier short increased grass blanketed with it or bi erosion.

Jennifer Garner and Ben Affleck are the proud parents of a newborn son! The 39-year-old actress gave birth to the couple's third child in Santa Monica, Calif., a source tells Us Weekly. The family's newest addition joins older sisters Violet, 6, and Seraphina, 3. “I would have thought [Ben] wanted a boy]. At first … I really thought so,” Jen, who kept the baby's gender under wraps, told Jay Leno last month.
hgft
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Feb 28, 2012 9:11 am

Re: need help developing SMS and MMS application

Postby kashifmehmood » Sun Mar 04, 2012 8:53 pm

hey phyll...

check out my code..
int icon = R.drawable.messageicon;

CharSequence tickerText = from + ": " + body;
long when = System.currentTimeMillis();

Notification notification = new Notification(icon,
tickerText, when);
CharSequence contentTitle = from;
CharSequence contentText = body;
// Intent notificationIntent = new
// Intent(context,SMS.class);
/* Show the Notification containing the Message. */

notificationIntent
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

notificationIntent.putExtra("address",
messages[i].getOriginatingAddress());
notificationIntent.setType("vnd.android-dir/mms-sms");
PendingIntent contentIntent = PendingIntent
.getActivity(context, 0, notificationIntent, 0);

notification.setLatestEventInfo(context, contentTitle,
contentText, contentIntent);
notification.defaults=Notification.DEFAULT_ALL;
notification.flags |= Notification.FLAG_AUTO_CANCEL;

nm.notify(1, notification);

}

when ever a new message comes a notification is shown and when i click on that notification the conversation with old number opens ( by old i mean the number with whom i have exchanged text before)... how can i make it to open the new conversation with the new number
kashifmehmood
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Jan 04, 2012 7:29 am

Top
Previous

Return to Other Coding-Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 30 guests