How to get Application name from package name in android?
<p>I am developing an app in which if any app is installed in device I have to update to server with app name for that I have to get Application name from package name.</p>

<p>for example :- from package let suppose :- <code>&lt;com.example.Deals&gt;</code> from this I have to get only <code>&lt;Deals&gt;</code>. How can I do that.</p>

<p>here is my code from which I got package name using Broadcast receiver.</p>

<pre><code>public class Receiver extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    String action = intent.getAction();
    if(action.equals("android.intent.action.PACKAGE_ADDED")){
        Logger.debug("DATA:"+intent.getData().toString());
    }
    if(action.equals("android.intent.action.PACKAGE_REMOVED")){
        Logger.debug("DATA:"+intent.getData().toString());
    }
    if(action.equals("android.intent.action.PACKAGE_REPLACED")){
        Logger.debug("DATA:"+intent.getData().toString());
    }
}
</code></pre>

<p>}</p>