geezy
I hate code!
Profile
Posts: 1
Reg: Mar 15, 2016
meadowlands
10
03/19/16 09:07 PM (8 years ago)

NONE BUZZTOUCH related question,how do i g add ps co-ordinates on the sms that the is sent ,on the code bellow

package com.jam.harambeesecrityapp; import android.support.v7.app.ActionBarActivity; import android.telephony.SmsManager; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MainActivity extends ActionBarActivity { private Button btnAlert; private String num1=""; private String num2=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onStart() { super.onStart(); Intent i = getIntent(); num1 = i.getStringExtra("num1"); num2 = i.getStringExtra("num2"); btnAlert = (Button) findViewById(R.id.btnAlert); btnAlert.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg) { sendSMSMessage("Please Help me."); } }); } protected void sendSMSMessage(String messageText) { //Log.i("Send SMS", ""); String phoneNo = num1; String phoneNo2 = num1; String message = messageText; try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNo, null, message, null, null); Toast.makeText(getApplicationContext(), "SMS sent to ."+ num1, Toast.LENGTH_LONG).show(); smsManager.sendTextMessage(phoneNo2, null, message, null, null); Toast.makeText(getApplicationContext(), "SMS sent to ."+ num2, Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "SMS faild, please try again.", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } @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); } }
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/21/16 04:13 AM (8 years ago)
you'll need to implement a 'location listener' for android... Get the coordinates from the location listener, and add it to your message body. You can figure out the code from here: https://www.javacodegeeks.com/2010/09/android-location-based-services.html or you may want to become a member of Buzztouch. Becoming a member will allow you to download a lot of free plugins, one of which is the 'Smug Message Location' which does pretty much exactly what you're trying to do. http://www.buzztouch.com/plugins/plugin.php?pid=E68E235A292B9B65CE07FC6 Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.