Intent and Intent Filters

 

A intent is an abstract description of an action to be performed. Also known as a messaging component that is used to request certain action from another component.

Intents have basic fundamental use cases:

  1. To start an activity: Used to start new instance of an activity by passing intent to it.
    ie. startActivity(new Intent(<CONTEXT_PACKAGE>, <CLASS>)).
    Similarly, if we want to receive a result from the starting activity then we use startActivityForResult(<INTENT>, <RESULT_CODE>).
  2. To start a service: Start a service to perform one time service by passing intent to startService(<INTENT>).
  3. To deliver a broadcast: Deliver broadcast to other apps by passing intent on functions such as sendBroadcast(<INTENT>). There are other ways to send broadcasts as well which will help differentiate what type of broadcast is being delivered. Learn more here.

Intent Types

There are two types of intents Continue reading

Four Building Blocks of Android

Lets talk about the four fundamental building blocks from which all the android applications are built. These building blocks are implemented as Java classes.

Android Component

Here is a diagrammatic representation of android application fundamental which explores android components and other fundamentals by Romain Chaippinelli.

application fundamental

 

 

 

 

 

 

Lets understand the four building blocks Continue reading

Dalvik Virtual Machine

We might think that as android is written in java it should also run on Java Virtual Machine using Java Compiler to compile its code. However, this is different in android ie. android uses Dalvik Virtual Machine to execute its code.

Why?

Dalvik Virtual Machine was build to make applications run in environment with resource constrains. By resource constrains what do we mean here is, comparatively mobile devices run under particularly low memory while desktop devices or laptops are high end devices with lesser constrains like this. Hence, Dalvik VM was specially designed to run on resource-constrained environment.

Extra Info: Dalvik byte codes Continue reading

Introduction to Android

Android is an operating system which was build for mobile devices and tablets. It is a software stack comprising not only operating system but also middleware and key applications.

The Platform

Android provides low level system software to high level end user application software. Android includes Linux kernal based OS, rich UI, multiple build in software, Telephony services, multimedia frameworks etcs. One of the best part about android platform is regardless of how strong a build in application might be you can always build similar powerful applications with access to all the resources on the device. Since android is an open source platform you can also get application level codes and start experimenting with it.

The Layer of Android Architecture

Linux Kernel: This provides a Continue reading

Install Android Virtual Device (GenyMotion)

Let’s dive into installing genymotion as a virtual device for you android applications.

Download and install virtual box (Optional)

Download VirtualBox + follow instructions to install.

SignUp for GenyMotion and download it’s installer

Sign up for an account  here.

Download the appropriate installer with (if you have skipped first step) or without virtualbox.

Run the GenyMotion Application

Select Virtual device you want to install.  Continue reading

Create Notification in Android

Notifications

A notification is a message you can display to the user outside of your application’s normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area. To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time.

Building Notification

Screenshot_20160308-130922

 

Continue reading

Alarm Manager

 

Whatever we code in android are made to be executed at that moment. But what if we want to trigger an event or task or an action in a time in future; may be after 15 mins , and hour or a day. To help ease this process the class AlarmManager is provided to us.

Lets get started and learn more about alarms.

Alarm Manager

 

Alarms:

What is an alarm? Alarms are the mechanism to schedule an intent in specific time in future.

Why do we need an alarm? We need an alarm to perform an action in future even if the application is not running.

Have we ever noticed that even if we exit the bluetooth connection application; it’s visibility timeout will be disabled at the mentioned time? Another obvious example is our clock.

Alarms can we very useful if you want to develop an app that allows certain notifications or triggers in future and perform respective functions.

Alarm Manager:

Quickly we’ll dive into the basics of alarm creation and take a look at the APIs provided for alarms.

  • Get an access to system’s alarm services:
    • getSystemService(ALARM_SERVICE)
  • Creating alarms
    • one-shot alarm
      • void set(int type, long triggerAtMillis, PendingIntent operation)
    • repeating alarm
      • void setRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation)
    • repeating alarm in exact trigger time
      • void setInexactRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation)

Continue reading

AndEngine Simple Android Game Tutorial

Here I go taking on Android Game Development with AndEngine.
This is a detailed simple blog post to help get started with Android Game Development.

Jimmar's blog thingie

WARNING: This is an outdated tutorial for the old AndEngine GLES1.0, if you want a tutorial for the new GLES2.0 then Check my Jimvaders tutorial ..

After playing around with the Android SDK , I thought that I should give game development a test drive. After giving Cocos2D a test, I faced the problem of online support, almost all the tutorials I found online were for the iOS version.. so I looked for other Engines made for Android.

AndEngine is an awesome game engine I found, but I couldn’t find a whole game tutorial.. so I thought that I’d port Dan’s simple Android Game tutorial (that’s actually ported from Ray’s iPhone cocos2D tutorial)

This tutorial will cover:
– Adding/Removing sprites
– Using timeHandlers
– Moving sprites
– Using Sound/Music
– Pausing/Resuming your game
– Simple collision detection

View original post 2,329 more words

Paypal REST API Verification

The REST Api for Paypal payment is used when the payment is made from a source other than Paypal account i.e.  using a Credit Card information.

Credit Card Payment

Before we verify credit card payments, there are few steps we should do to make REST Api available for our app.

  • Get Access Token for your App
  • Making sure the recipient is our account
  • Check the account and currency of Payment

Access token helps Paypal authenticate our app account and at the same time uniquely identify transactions.

  1. Getting Access Token
    Continue reading

Get an Access Token for REST Api

Access Token

This is a key provided by Paypal once it has verified our app and account as being authorized in Paypal. We will mostly use access token for REST Api calls in Paypal. Access token helps uniquely identify the authorized bearer of Paypal.

The Fields in Response we receive

  • access_token : The unique key we are trying to gain
  • token_type : The specification for the key , here it is authorized as being a bearer key.
  • app_id : Our app ID, make sure this is the ID of your app.
  • expires_in : Each token has an expiry date specified in seconds, for eg. 28800 . So make sure to gain your access token right before you intend to use one.

Before we can get an access token we need to create a Continue reading