Posts

Showing posts from May, 2011

Android Progress Dialog Example

Image
In situations when you need to wait some operation it is good practice to notify user that operation is in progress.For this cases in Android present several classes which can help with this. One of them I am going to demonstrate. In this tutorial, I will show you how to add a progress dialog to your Android application. A dialog is usually a small window or tab that appears before any activity in your application. It is intended to display alerts or information to the user. A progress dialog can be used to either show some processing activity to the user or to show the progress of some custom activity using the progress bar. To create a Progress Dialog, we can make use of the ProgressDialog class which is an extension of the AlertDialog class. It can be used to display a standard progress dialog with a spinning wheel and some custom text. You can display your Progress Dialog using a simple show () call on your dialog object. Here's the syntax to create a standard Progress dial...

Error: Unable to open class file R.java and How to fix it.

[2011-05-27 12:12:39 - listActivity] ERROR: Unable to open class file /root/workspace/Manifest.java: No such file or directory [2011-05-27 13:50:38 - listActivity] ERROR: Unable to open class file /root/workspace//R.java: No such file or directory R.java and Manifest.java is a automatically generated file. The ADT has a few such annoying bugs. But you can sort them out.. What usually helps is: 1. Close Project->Open Project > Build Automatically . 2.Another thing that sometimes helps is right click project > android tools > fix project properties and remove unnecessary content or jar files. 3.Or you can do Project->clean and Refresh . If still it not generating R.java files then check your class there must be a extra line.. Import R.java.*; Remove that and then do all the above one by one.. Hope it help .. If someone know other way please let me know. T...

Conversion to Dalvik format failed with error 1

Sometime You will encounter this problem when trying to Build Android Project on Eclipse..  You will get such output in console: [2011-05-24 09:25:03 - Android C2DM] Dx 1 error; aborting [2011-05-24 09:25:03 - Android C2DM] Conversion to Dalvik format failed with error 1 You can solve this problem: Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 2.2). click OK.  and then Go to Project » Clean » Clean projects selected below » select your project and click OK.   That work for me. Hope it works for you too.!!!!

Third Party Applcation Server

Image
The Third Party Server is *your* server and can actually be any process written in any language (for example, it can be a batch process or a cron script). The role of the 3rd party "server" is to send the message to the device. The Server will store (or update) the registrationID received into its local database. So, eventually the server will have registrationIDs from the devices. Your server needs to get a ClientLogin Auth token in order to talk to the C2DM servers. When it wants to push a message to the device. For ClientLogin Auth_Token:  Click Here To send a message to a particular device, the Server needs to POST to the C2DM Service the following 4 things:  The accountName which will be arxxus.pushapp@gmail.com . An authentication Token. The registrationID of the device it wants to send the message.  The message itself (Message limit 1024 Bytes) Code: // Create a new HttpClient and Post Header  HttpClient httpclient = new DefaultHttpClient()...

Software Release life cycle

Image
Life Cycle of Software Release : A software release lifecycle consists of different stages that report the stability of a piece of program and the amount of development is necessary before the final release. It is the distribution of software code, documentation, and support materials and composed of discrete phases that describe the software's maturity as it advances from planning and development to release and support phases. Each version of a product goes through a stage when new features are added, or the alpha stage, a stage that is being actively debugged, or the beta stage, and finally a stage in which all major errors have been removed, or the stable phase. Intermediate stages may even be recognized. The stages can be formally announced and regulated by the developers of the project, but sometimes the terms are used informally to report the status of a product. Pre-alpha: Pre-alpha refers to all activities performed during the software project prior to testing. These...

Google App Engine - Restrictions

Google offers a cloud computing infrastructure called Google App Engine (App Engine) for creating and running web Applications. App Engine allows the dynamic allocation of system resources for an application based on the actual demand. Currently App Engine supports Python and Java based applications. But Google App engine have some Restrictions GoogleApp Engine runs a version of Java 6 but does not provide all Java classes, for example Swing and most AWT classes are not supported. You cannot use Threads   or frameworks which uses Threads. You can also not write to the filesystem and only read files which are part of your application. Certain "java.lang.System" actions, e.g. gc() or exit() will do nothing. You can not call JNI code. Reflection is possible for your own classes and standard Java classes but your cannot use reflection to access other classes outside your application. A servlet needs also to reply within 30 seconds otherwise a com.google.apphosting.api.Dead...

ClientLogin for Installed Applications for C2DM - Tutorial

Image
Before you can write client applications that use the C2DM feature, you must have an HTTPS application server that meets the following criteria:Able to communicate with your client. Able to fire off HTTP requests to the C2DM serve r. Able to handle requests and queue data as needed. For example, it should be able to perform   exponential back off.  Able to store the ClientLogin Auth token and client registration IDs. The ClientLogin Auth token is included in the header of POST requests that send messages. For more discussion of this topic, see  ClientLogin for Installed Applications . The server should store the token and have a policy to refresh it periodically. The ClientLogin authorization process: Authorization with ClientLogin involves a sequence of interactions between three entities: the installed application, Google services, and the user. This diagram illustrates the sequence: When the third-party application needs to access a user's Googl...

Android Cloud to Device Messaging(C2DM) Tutorial

This tutorial is for getting started with Android Cloud to Device Messaging (C2DM) on Android. In the iOS world it is knows as “push notifications”. This feature will definitely help developers and their apps to streamline and optimize the data transfers. This would mean that apps now do not have to poll their servers at regular intervals to check for updates. The servers will be able to send updates (like Push Notifications) to the devices and makes it easier for mobile applications to sync data with servers. There are many different ways of accomplishing the same thing(polling,constant server connections,SMS messages). C2DM Alternatives: Polling: The application itself would periodically poll your servers to check for new messages. You would need to implement everything from queuing messages to writing the polling code. Alerts are no good if they’re delayed due to a low polling period but the more frequently you poll, the more the battery is going to die. SMS: Android can...

IPC:Shared Memory

Shared Memory Shared Memory is an efficeint means of passing data between programs. One program will create a memory portion which other processes (if permitted) can access. In the Solaris 2.x operating system, the most efficient way to implement shared memory applications is to rely on the mmap() function and on the system's native virtual memory facility. Solaris 2.x also supports System V shared memory, which is another way to let multiple processes attach a segment of physical memory to their virtual address spaces. When write access is allowed for more than one process, an outside protocol or mechanism such as a semaphore can be used to prevent inconsistencies and collisions. A process creates a shared memory segment using shmget()|. The original owner of a shared memory segment can assign ownership to another user with shmctl(). It can also revoke this assignment. Other processes with proper permission can perform various control functions on the shared memory segment using s...