http://codesmith.in/post-data-google-drive-sheet-through-mobile-app/
Sunday, 31 January 2016
Monday, 30 November 2015
android service
https://www.youtube.com/watch?v=GAOH7XTW7BU
Sunday, 29 November 2015
schedule a repeating task
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
synchronized public void run() {
\\ here your todo;
}
}}, 60000, 60000);
http://stackoverflow.com/questions/14376470/scheduling-recurring-task-in-android
timer = new Timer();
TimerTask task = new TimerTask(){
@Override public void run() {
new GetJson().execute(url);
}
};
long whenToStart = 5*1000L; // 5 secondslong howOften = 5*1000L; // 5 secondstimer.scheduleAtFixedRate(task, whenToStart, howOften);
heads up notification 2
private void showNotification(boolean showAsHeadsUp) { final Intent intent = getIntent(); intent.putExtra("launched_from_notification", true); final Notification.Builder nb = new Notification.Builder(this); nb.setContentTitle("Foobar"); nb.setContentText("I am the content text"); nb.setOngoing(true); nb.setSmallIcon(android.R.drawable.ic_dialog_info); nb.setContentIntent(PendingIntent.getActivity( this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT)); nb.setPriority(Notification.PRIORITY_HIGH); // Notifications without sound or vibrate will never be heads-up nb.setDefaults(showAsHeadsUp ? Notification.DEFAULT_ALL : 0); ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, nb.build()); }
heads up notification
private void showHeadsUpNotification() { final Notification.Builder nb = new Notification.Builder(this); nb.setContentTitle("Foobar"); nb.setContentText("I am the content text"); nb.setDefaults(Notification.DEFAULT_ALL); nb.setOngoing(true); nb.setSmallIcon(android.R.drawable.ic_dialog_info); nb.setContentIntent(PendingIntent.getActivity(this, 0, getIntent(), 0)); // Commenting this line 'fixes' it by not making it heads-up, but that's // not what I want... nb.setPriority(Notification.PRIORITY_HIGH); ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, nb.build()); }
Saturday, 28 November 2015
delay any event in android
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 100ms
}
}, 100);
Thursday, 29 October 2015
php to send json
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "userdata";
$connect = mysql_connect($servername, $username, $password);
$check = mysql_select_db($database, $connect);
if (!$check) {
echo"not connected bro";
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
if ($name == '' || $username == '' || $password == '' ) {
echo 'please fill all values';
} else {
$numrow = 0;
if ($numrow > 0) {
echo "values already exist";
} else {
$sql = "INSERT INTO `uesr` (`id`, `username`, `password`) VALUES (NULL, '$username', '$password')";
$result = mysql_query($sql);
echo "successfully resgistered";
}
}
}
?>
$servername = "localhost";
$username = "root";
$password = "";
$database = "userdata";
$connect = mysql_connect($servername, $username, $password);
$check = mysql_select_db($database, $connect);
if (!$check) {
echo"not connected bro";
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
if ($name == '' || $username == '' || $password == '' ) {
echo 'please fill all values';
} else {
$numrow = 0;
if ($numrow > 0) {
echo "values already exist";
} else {
$sql = "INSERT INTO `uesr` (`id`, `username`, `password`) VALUES (NULL, '$username', '$password')";
$result = mysql_query($sql);
echo "successfully resgistered";
}
}
}
?>
Subscribe to:
Posts (Atom)