Thursday, August 30, 2012

Jelly Bean (JB) live wallpaper

,
Get new Jelly Bean wallpaper on your devices!
Download the free Jelly Bean (JB) live wallpaper featuring floating particles. You can also change different type of particles in settings screen.
Now with 5 floating particle types: Capsule, Bean, Beam, Droid and Star!
To use: Home -> Menu -> Wallpapers -> Live Wallpapers
To develop more free great live wallpapers, we have implemented some ads in settings.
Advertisement can support our develop more free great live wallpapers.
Our wallpaper contains "NO notification or icon ads"!!
This live wallpaper has been tested on latest devices such as Samsung Galaxy S3 and Galaxy Nexus. Please contact us if your device is not supported.
Note: If your wallpaper resets to default after reboot, you will need put the app on phone instead of SD card.

App Screenshots



Download

Tuesday, August 28, 2012

Take Screenshots and Share Them on an Android Device

,





For those new to Android, and the target audience of this guide, you may not know this, but taking screenshots on an Android device used to be quite the task. In fact, if you didn’t own a Samsung device, you had to root your phone and install a 3rd party app that would take them, or set up the Android SDK. Most of us could never figure out why the Android team wouldn’t make this ability widely available, but now that Ice Cream Sandwich and Jelly bean are seeing wider adoption, we no longer have to worry about it. So since most of you are buying devices that run one of these two versions of Android, let’s talk about how you can take screenshots and them share them quickly with your friends. 

Instructions (Most Android Devices Running Android 4.0+):

*This includes most tablets as well, including the Nexus 7.
1.  Head to the screen that you would like to take a screenshot of.
2.  Press and hold Power+Volume Down at the same time for 3-5 seconds.
3.  Your phone should make a camera shutter noise and show you a preview of a screenshot.
4.  Congrats, you just took a screenshot that is available in your gallery.
5.  To quickly share it, you’ll find a notification for that screenshot in your notification bar.
6a.  Pull down your notification bar and tap on the Share icon.
6b.  If not on Jelly Bean, you’ll have to tap on the notification to get to the image, then the Share icon.
7.   Now, choose the service that you would like to share the picture with.
*Note – Most HTC devices will let you preview the image from your notification bar, but will not let you share directly from that preview, even if you have tapped on it. It’s a massive pain in the rear, but you have to exit the preview and go through your gallery, find the picture, tap on it, and then share it.

Instructions (Most Samsung Devices):

*This does not include the Galaxy Nexus or Nexus S. Use the top instructions for that device.
1.  On almost any Samsung device, open the screen that you would like a screenshot of.
2.  Press Power+Home for 3-5 seconds until a screenshot preview shows on your screen.
3.  Congrats, you just took a screenshot!
4.  To share, tap on the notification for it in your notification pulldown menu.
5.  Tap o the Share icon and share it with the service of your choice.

Alternate Instructions (Galaxy S3):

*Samsung built in a motion activity that lets you take screenshots by simply swiping across your screen, rather than having to simultaneously press buttons. I’m not a fan of it and find it incredibly finicky, however, you may have better luck.
1.  Visit the screen that you would like to take a screenshot of.
2.  Place your hand perpendicular to your phone with the side of your pink on one edge of the display.
3.  Slide your hand across the screen.
4.  If successful, your phone should make a camera shutter noise and the screen will animate.
5.  Your screenshot will be saved to your gallery.

by:

Monday, August 20, 2012

PHP for Android project (PFA)

,

Introduction


PHP for Android project (PFA) aims to make PHP development in Android not only possible but also feasible providing tools and documentation.
We currently have an APK which provides PHP support to SL4A (PhpForAndroid.apk) and we're working in a manual.
Irontec is the company behind this project. About this project
FAQ (Frequently Asked Questions)

Getting help, getting involved


Google groups
Subscribe to PhpForAndroid discussion group
E-mail:
Visit this group
Issue tracker (problems and feature requests) : http://code.google.com/p/php-for-android/issues/list
Besides, a few wiki pages have a comment system at the bottom (this one e.g).

PhpForAndroid-APK

SL4A (Android Scripting Environment) is a Google-mantained project which “brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device”.
PhpForAndroid-APK provides PHP support to SL4A.
Screencasts

Requirements

min: Android OS 1.5 (phone or emulator)
Enable “Unknown Sources” under Application settings.

Install SL4A (Android Scripting Environment)

barcodeDon't have barcode reader? Click here.
Download SL4A
SL4A only comes with a shell interpreter by default.

Install PhpForAndroid.apk

barcodeDon't have barcode reader? Click here.
Download latest release (Releases page)
Once installed, run it and tap on “Install”.
The PHP binary and the scripts will become available to SL4A.
Now!, run SL4A. You should be able to see PHP demo scripts and they should work!.
Doesn't it work? Please, try uninstalling and installing again (this is alpha software).
Still not working? Fill this survey please: http://www.zoomerang.com/Survey/WEB22AXDHRY8L5

Getting started

The real time ways (no more install, no SDK, nothing required)

1. Add/Edit PHP scripts on your mobile

SL4A allows you to add or edit scripts on your mobile.

2. Use testnow.php

“allow_url_include” is On by default so you can include your code easily.
Include your own internet publicly available script. You'll find an already installed php script called “test.php”:
<?php
require_once("Android.php");
include("http://phpforandroid.net/files/testnow.php.txt"); // ".txt" extention required to prevent parsing
TODO Tell about remote, using SDK

How to distribute your PHP script as APK

Manual

We're working in a manual with all this information and more:
manual-en

Screencast

Check out our screencasts for easy installation on your terminals.

Problems?

Fill the following survey: http://www.zoomerang.com/Survey/WEB22AXDHRY8L5
or leave a comment with the following info: brand, model, android version and a brief text with the problem.
or join the pfa group and tell us.

Saturday, August 4, 2012

Enabling Google Analytics to Gather App Statistics

,
Google Analytics is a service provided by Google that makes it easy to track what users do. The Google Analytics team released an Analytics SDKs for mobile platforms including Android, iOS (Apple), and mobile websites. In this tutorial, learn how to include and enable this technology within your Android projects to gather important information about how users are using your applications.
Note: This tutorial has been updated to work with the latest version of the Google Analytics for Android SDK Release 2 (in the Android SDK Manager), with Version 1.4.2 listed in the ReadMe.txt file and on the website download link. This tutorial was originally posted July 5, 2011.
The Google Analytics SDK for Android provides helpful classes and methods to track user activity and generate useful statistics about your Android app activities. The underlying service was originally designed for website tracking, but it’s been adapted for use with mobile apps. Recently the team launched a beta program for “live” statistics, so there is no longer a 24 hour delay from when the statistics are logged to the service, and when they appear in the online reports.
Google Analytics is a client-server solution. Android developers add hooks within their application code to log different types of user activities at key points in the app lifecycle and upload this data to the Google Analytics server. Then later, when the application is deployed and used, those statistics are collected from various users. The developer logs into the Google Analytics website and views the aggregate statistics by generating different types of reports and viewing graphs and charts.

Step 1: Getting Started

There’s no point in hooking up Google Analytics unless you’ve already designed an Android application. Therefore, you’ll want to start with an application that is already pretty complete, in order to add statistics gathering in the appropriate code locations. This tutorial assumes you have an existing Android project in Eclipse to work from.

Step 2: Registering for a Google Analytics Account

For the Google Analytics service to work, you must first create a developer account to send statistics to. Start by signing up for an account at http://www.google.com/analytics. This account must be linked to an underlying Google Account, so you may also want to create a Google account specifically for your application or company, so that it’s not tied to an individual. The accounts are free.
Account creation is easy. Login with your Google account, and enter some basic information. When prompted to enter a website for tracking purposes, choose a fake name (ideally including the name of your app and company domain, like http://myapp.mycompany.com). You will also need to set the location and time zone to normalize app statistics to. Finally, you’ll need to enter contact information for the account.
Once you’ve finished creating an account, Google Analytics will issue you a block of Javascript that can be used to drop into your “website” for tracking purposes. For mobile developers, you’re really only interested in the unique Web Property or UA number associated with your account that is embedded in this Javascript. This number starts with “UA-” followed by some numbers. Save off this information—you will need to use this unique account number within your application to send statistics to your specific Google Analytics account.

Step 3: Download the SDK

There are two ways to get your hands on the Google Analytics SDK for Android. You can download the SDK through the Android SDK Manager or you can download it directly from the Google Analytics website. Extract the zip and save the libGoogleAnalytics.jar file within a /libs sub-directory within your Android project directory (creating the directory, if necessary).

Step 4: Adding the Library to your Project

Next, you need to add the Google Analytics SDK for Android to your Android project. Adding a jar file to your project from within Eclipse is easy. Follow these steps:
  1. Click on the Project properties for your Android project.
  2. Under the Java Build Path settings, select the Libraries tab.
  3. Click the Add JARs… button and choose the jar within the /libs directory.

Step 5: Adding Permissions to Your Project

The Google Analytics service must send statistics over the Internet. This means that your Android application will require permissions to perform such operations. Therefore, add two permissions to your application, if they are not there already.

Click on the Permissions tab of the Android manifest file for your project. Add a new Uses Permission element for android.permission.INTERNET and another for android.permission.ACCESS_NETWORK_STATE. Save your Android manifest file.

Step 6: Adding Tracking Code To Your Project

You’re ready to start using the Google Analytics SDK for Android to collect statistics! Simply drop the tracking code into the appropriate areas of your application and go. This is highly dependent on your specific application and what sorts of statistics you want to gather.
You’ll need to import the tracker:

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
 
Get an instance of the tracker:

GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
 
Start the tracker, updating to Google every 30 seconds:

tracker.startNewSession("UA-12345678-9", 30, this); 
 
Track some usage (screens and dialogs map well to pageviews):

tracker.trackPageView("/HelpScreen"); 
 
Stop the tracker:

tracker.stopSession(); 
 
And with that, you’ve got simple usage tracking.

Conclusion

That’s all it takes to set up Google Analytics for Android with your project. The Google Analytics SDK for Android is an easy way to collect useful information about how people use your application. It supports the collection of a number of different types of statistical events. Most of the power and flexibility of Google Analytics comes from determining the proper functional code areas to add statistics collection hooks.
As always, we look forward to your feedback.

(tutsplus)

Friday, August 3, 2012

Capture and Crop an Image with the Device Camera

,

Many Android devices are equipped with built-in cameras. In this tutorial, we will work through the basic technique for capturing an image using the Android camera and then cropping it using apps the user already has installed on their device. Along the way, I’ll also show how to account for users whose devices do not support either the image capture or cropping actions.

Step 1: Start a New Android Project

Create a new Android project in Eclipse, or your chosen IDE. In your main Activity class, add the following import statements after the package declaration:
1
2
3
4
5
6
7
8
9
10
11
12
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
These will allow us to carry out image capture, crop and display within the app. Open your application’s strings XML file, which you should find in the “res/values” folder. Add the following strings:
1
2
3
<string name="intro">Capture a picture to crop!</string>
<string name="picture">Picture</string>
<string name="capture">Launch Camera</string>
We will use these strings within the user interface.

Step 2: Implement the App Layout

Let’s design the app layout. Open your main XML file, which should be in the “res/layout” folder. Use a Linear Layout as follows, which Eclipse may have already provided:
1
2
3
4
5
6
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
 
</LinearLayout>
Inside the Linear Layout, add the following text display:
1
2
3
4
5
6
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/intro"
    android:layout_margin="3dp"
    android:textStyle="bold" />
Here we display some informative text using a string we defined in the strings XML file. After the Text View, add a button as follows:
1
2
3
4
5
<Button
    android:id="@+id/capture_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/capture" />
The ID value will allow us to identify the button in Java, so that we can respond to clicks. Again, we use a string we already defined in XML. Finally, after the button, add an Image View:
1
2
3
4
5
6
7
<ImageView
    android:id="@+id/picture"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="@string/picture"
    android:layout_margin="5dp"
    android:background="@drawable/pic_border" />
We will place the image captured by the user with their device camera inside this Image View, using the ID value to identify it in Java. We use one of the strings as a content description and a background drawable resource we will create next. If you want the Image View to stretch to fill the available space, alter the width and height attributes to “fill_parent” instead of “wrap_content” – remember that this may make the image displayed appear poor quality.
For the background drawable, create a new XML file in each of your app drawable folders, naming it “pic_border.xml” to match the value we used in the Image View layout section. The easiest way to do this is to create the file in one drawable folder, copy the XML code into it, save it, then copy it into the other drawable folders.
Use the following XML in your new “pic_border” drawable file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    android:dither="true">
    <gradient
        android:startColor="#99ffffff"
        android:endColor="#99ffffff"
        android:centerColor="#00000000"
        android:angle="90" />
    <padding android:left="10dp" android:top="10dp"
        android:right="10dp" android:bottom="10dp" />
    <corners android:radius="5dp" />
    <stroke
        android:width="2dp"
        android:color="#ccffffff" />
</shape>
Using a drawable background resource is entirely optional, so feel free to omit this part. This is how the app will look when it is launched:
Initial App Interface

Step 3: Respond to User Clicks

In your app’s Activity class, extend the opening class declaration line as follows:
1
public class ShootAndCropActivity extends Activity implements OnClickListener {
Alter the class name to suit your own. Inside the Activity “onCreate” method, add the following after the existing code calling the superclass method and setting the content layout, which Eclipse should have populated:
1
2
3
4
//retrieve a reference to the UI button
Button captureBtn = (Button)findViewById(R.id.capture_btn);
//handle button clicks
captureBtn.setOnClickListener(this);
Here we simply instruct the class to handle button clicks. The user will press the button to launch the camera. Now we need to provide an “onClick” method. Add it as follows, after the “onCreate” method:
1
2
3
4
5
public void onClick(View v) {
    if (v.getId() == R.id.capture_btn) {    
     
    }
}
Inside the “if” statement, we will implement using the camera.

Step 4: Launch the Camera

At the top of your class declaration, before the “onCreate” method, add the following instance variables:
1
2
3
4
//keep track of camera capture intent
final int CAMERA_CAPTURE = 1;
//captured picture uri
private Uri picUri;
We will use the first variable to keep track of the user’s interaction as they navigate to the camera app and back. The second variable will store the URI of the captured image. Inside the “if” statement in your “onClick” method, add the following code to launch the camera Intent, including it in a “try” block:
1
2
3
4
5
6
try {
    //use standard intent to capture an image
    Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    //we will handle the returned data in onActivityResult
    startActivityForResult(captureIntent, CAMERA_CAPTURE);
}
When this code executes, the user’s camera app will start up and they will be able to take a photo. We will handle the user returning from the camera app inside the “onActivityResult” method. From there we will be able to check that the user is returning from this Intent using the “CAMERA_CAPTURE” variable we pass when starting the Activity. However, before we do that we need to handle the situation in which the user device does not support the image capture intent we have attempted to launch here. After the “try” block, add a “catch” as follows:
1
2
3
4
5
6
catch(ActivityNotFoundException anfe){
    //display an error message
    String errorMessage = "Whoops - your device doesn't support capturing images!";
    Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
    toast.show();
}      
Whenever you attempt to launch an Intent outside of your own app, this is a precaution you may wish to take. This is particularly the case with the cropping action which we will be exploring later, however this code pattern is a good habit to adopt in general, as user devices vary greatly. When the user accepts the photo they have captured, they will return to the app.
The Camera App

Step 5: Retrieve the Captured Image

We launched the camera app using “startActivityForResult” so we now need to handle the result. Add the “onActivityResult” method after the “onClick” method as follows:
1
2
3
4
5
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
         
    }
}
Inside the “if” statement, add another to check that we are returning from the camera app, using the variable we passed:
1
2
3
4
//user is returning from capturing an image using the camera
if(requestCode == CAMERA_CAPTURE){
             
}
We will also return to the “onActivityResult” method after the user crops their image, so we will add an “else if” later. Inside this “if” statement, add the following code to retrieve the URI of the captured photo:
1
2
//get the Uri for the captured image
picUri = data.getData();
Now we need to pass this URI to an app that can crop it. We will use a helper method to achieve this, so add the following method call:
1
2
//carry out the crop operation
performCrop();

Step 6: Crop the Captured Image

Add the helper method we called after the “onActivityResult” method:
1
2
3
private void performCrop(){
 
}
Inside this method we are going to call an Intent to perform the crop, so let’s add “try” and “catch” blocks in case the user device does not support the crop operation:
1
2
3
4
5
6
7
8
9
try {
 
}
catch(ActivityNotFoundException anfe){
    //display an error message
    String errorMessage = "Whoops - your device doesn't support the crop action!";
    Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
    toast.show();
}
We use the same technique we used when launching the camera Intent. If the user device does not support the cropping Intent, they will see an error message. Inside the “try” block, launch the Intent as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    //call the standard crop action intent (the user device may not support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
    //indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
    //set crop properties
cropIntent.putExtra("crop", "true");
    //indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
    //indicate output X and Y
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
    //retrieve data on return
cropIntent.putExtra("return-data", true);
    //start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP); 
Here we set various properties for the cropped image, instructing the app to retrieve the resulting image data when the crop is complete. If you want the cropped image dimensions to differ from this, alter the “outputX” and “outputY” lines accordingly. We call the Intent using “startActivityForResult”, so will retrieve the result inside “onActivityResult” again. As with the camera Intent, we pass a variable to keep track of which Intent we are returning from, so add a variable declaration at the top of the class, next to the other instance variables:
1
2
//keep track of cropping intent
final int PIC_CROP = 2;
Image Cropping
As well as cropping, the user can select an area of the image.
Crop Detail

Step 7: Display the Cropped Image

Finally we can retrieve the cropped image and display it within the app UI. Inside your “onActivityResult” method, after the “if” statement in which you check for the “CAMERA_CAPTURE” request code, add an “if else” statement checking for the “PIC_CROP” code, in which case we are returning from the crop operation:
1
2
3
4
//user is returning from cropping the image
else if(requestCode == PIC_CROP){
 
}
Inside this statement, we can retrieve the returned cropped image as follows:
1
2
3
4
//get the returned data
Bundle extras = data.getExtras();
//get the cropped bitmap
Bitmap thePic = extras.getParcelable("data");
We now have the user’s cropped image as a Bitmap. Let’s display it in the Image View as follows:
1
2
3
4
//retrieve a reference to the ImageView
ImageView picView = (ImageView)findViewById(R.id.picture);
//display the returned cropped image
picView.setImageBitmap(thePic);
Now the cropped image will appear inside the app UI as soon as the user returns from cropping. Save and run your app on an actual device to test it.
Displaying the Image in the App

Conclusion

In this tutorial we have explored the basic capture and crop process within the Android SDK. However, the crop action in particular can be a little unpredictable on the various user devices in operation. Lots of different apps can handle the crop operation, so some developers adopt a more complex algorithm to resolve the user choices, presenting these apps to the user as a list of options to choose from. Whatever apps the user environment provides, the basic process of capture and crop remains the same.

(tutsplus)


 

Android Development Tutorials Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger Templates