Friday, May 8, 2015

send message on WhatsApp without opening WhatsApp application on rooted Android phone.

Hello all,


I am going to show you how to send message without opening whatsapp application on Android, means you can send message in background

1) First of all rooted phone must be required.

2) After you root phone just download below application

         https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot&hl=en

this application will install sqlite3 on your phone, because many rooted phone has not built in sqlite3

3) Download following

https://github.com/dschuermann/superuser-commands

this is used to execute command


just import above code to your eclipse

in that there is example

in that there is BaseActivity.java file

just repace code in BaseActivity.java file with following code


package org.sufficientlysecure.rootcommands.demo; import java.util.Random; import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.command.SimpleCommand; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class BaseActivity extends Activity { public static final String TAG = "Demo"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); System.out.println("BaseActivity"); // enable debug logging RootCommands.DEBUG = true; whatsAppSendMessage(new String[] { "CountryCode like for India 91"+"HERE IS YOUR 10 DIGIT MOBILE NUMBER" }, "HERE IS YOUR MESSAGE"); //for example here result is :- 91XXXXXXXXXX } public void commandsTestOnClick(String command) { System.out.println("Command :- " + command); try { // start root shell Shell shell = Shell.startRootShell(); // simple commands SimpleCommand command2 = new SimpleCommand(command); shell.add(command2).waitForFinish(); // close root shell shell.close(); } catch (Exception e) { Log.e(TAG, "Exception!", e); } } protected void whatsAppSendMessage(String[] paramArrayOfString, String paramString) { try { Shell shell = Shell.startRootShell(); int j = paramArrayOfString.length; for (int i = 0; i < j; i++) { String str3; long l1; long l2; int k; String str1; String str2; Random localRandom = new Random(20L); Log.d("AUTO", "ps | grep -w 'com.whatsapp' | awk '{print $2}' | xargs kill"); commandsTestOnClick("ps | grep -w 'com.whatsapp' | awk '{print $2}' | xargs kill"); str3 = paramArrayOfString[i] + "@s.whatsapp.net"; l1 = System.currentTimeMillis(); l2 = l1 / 1000L; k = localRandom.nextInt(); str1 = "sqlite3 /data/data/com.whatsapp/databases/msgstore.db \"INSERT INTO messages (key_remote_jid, key_from_me, key_id, status, needs_push, data, timestamp, MEDIA_URL, media_mime_type, media_wa_type, MEDIA_SIZE, media_name , latitude, longitude, thumb_image, remote_resource, received_timestamp, send_timestamp, receipt_server_timestamp, receipt_device_timestamp, raw_data, media_hash, recipient_count, media_duration, origin)VALUES ('" + str3 + "', 1,'" + l2 + "-" + k + "', 0,0, '" + paramString + "'," + l1 + ",'','', '0', 0,'', 0.0,0.0,'',''," + l1 + ", -1, -1, -1,0 ,'',0,0,0); \""; str2 = "sqlite3 /data/data/com.whatsapp/databases/msgstore.db \"insert into chat_list (key_remote_jid) select '" + str3 + "' where not exists (select 1 from chat_list where key_remote_jid='" + str3 + "');\""; str3 = "sqlite3 /data/data/com.whatsapp/databases/msgstore.db \"update chat_list set message_table_id = (select max(messages._id) from messages) where chat_list.key_remote_jid='" + str3 + "';\""; Log.d("AUTO", str1); Log.d("AUTO", str2); Log.d("AUTO", str3); shell.add( new SimpleCommand( "chmod 777 /data/data/com.whatsapp/databases/msgstore.db")) .waitForFinish(); shell.add(new SimpleCommand(str1)).waitForFinish(); shell.add(new SimpleCommand(str2)).waitForFinish(); shell.add(new SimpleCommand(str3)).waitForFinish(); } shell.close(); } catch (Exception e) { e.printStackTrace(); } } }