Adventures of an Entrepreneur
  • Creating a Mobile Apps/Games Company

How to unpack / pack an APK file

3/31/2014

17 Comments

 
Did you know that when you download an Android App from Google Play or Amazon Store, you are actually downloading 1 single file?

That file has an APK extension and it is a kind of zip file. In fact, if you rename the extension from APK to ZIP and extract it, you will be able to navigate thru its asset files (images, audio,...). But unzipping the file does not make all its content accessible. E.g, if you try to open the AndroidManifest.xml, you will see that its content is not on plain text. So, if you want to correctly unpack all files from the APK, you can use a tool called apktool.

Here is a step-by-step tutorial to unpack an APK file:

1) Download the apktool file and its system dependency file, both available for free here. (For example, If you are using an MAC, you will have to download: apktool1.5.2.tar.bz2 and apktool-install-macosx-r05-ibot.tar.bz2). 

2) Extract both files to same directory (to make things easier :) )

3) Put the apk file that you want to unpack in that same directory

4) Unpack the apk doing with the following command: "./apktool d [your apk file]" (this is a MAC/linux
command, if you are using Windows, it should probably be "apktool d [your apk file]")

 That is it, the apktool will have created a new directory with the same name of your apk file where you will find the apk content.

If you want to pack that directory back again into an apk (let's say, after you edited something), just use the following command: "./apktool b [apk dir name] [apk file.apk]"




Important note: when you unpack and pack back the apk, it loses its android signature. So, if you want to install that apk on a device, you have to sign it again using the android Debug Key or your own key. You can do that by running the following command: "jarsigner -verbose -keystore [your keystore file] [your apk file.apk] [your keystore alias]"
17 Comments

Setting up AWS SNS to send Push notifications to iOS devices

3/7/2014

32 Comments

 
Hi.

Today I will be showing you how to set up AWS SNS. The Amazon Web Services (AWS) Simple Notification Service (SNS) is a service that allows developers to use the AWS infrastructure to send Push notifications to devices (it can also be used to send SMS or messages to other services like the AWS Queue, but these are not in the scope of this tutorial).

Push notification are those messages that smartphone/tablet users receive that popups in the device screen. They are called as "Push" because it is the server that pushes the message to the device and not the app that requests the message from the server. 

Let's start.

#1) Log into your AWS Management Console and click on "SNS Services" under the "App Services" category.
Picture
#2) In the SNS dashboard, select the Region that you want to use for the SNS Service. Theoretically, you should select a region that is closer to your end users. We will be using N.Virginia for this tutorial.
Picture
#3) Click on "Add a New App"
Picture
#4) Fill the required info.
Application Name:  You can choose any app. I like to set a name that relates to the app that this SNS will provide the messages
Push Platform: You need to choose what platform will this SNS use. If your app is an iOS app, you need to choose the Apple Push Notification Service (APNS). During development, it is recommended to use the Apple Push Notification Service Sandbox (APNS_Sandbox). You also have the option to choose the Google service or Amazon. We will choose here Apple Push Notification Service Sandbox.
Credentials: in this section you will have to enter the credentials of the Push Platform selected above. On the APNS, we need to enter the Certificate and Private Key. We can enter them directly in the box or we can simply select the P12 private key file and the Certificate and Private Key info will be automatically filled. Let's do it by the simple way (choosing the file).
Picture
You probably are asking "Where is that p12 private file??". It is probably nowhere yet. We need to export it from the Keychain Access of your MAC developer machine. Of course, you already need to have it installed in your MAC, if you don't have it, please read my previous post on "Enabling Push Notifications for an iOS app". Let's export that private key then.

#4.1) Access your Keychain Access and select "Login" in the Keychains#4.2) Make a right click on the correct app private key and select Export.
Picture
#4.3) Set a password for the file.
Picture
#4.4) The system will ask for you MAC login password before exporting the file. 
Picture
$4.5) Save the p12 file somewhere. 
Picture
#5) Now, go back to the AWS SNS New App screen and select the private key that you just exported. It is a p12 file.
#6) Enter the password that you set on the item #4.3 and press "Load Credentials from File"
#7) Now, just click on "Add New App"
Picture
That is it. Now you have set the AWS SNS to send Push Notifications. 

You maybe thinking: "Ok, but how do I send a Push message?". Well first you need to register the device that will receive the Push Notification with the SNS service.

In SNS Dashboard of the app that you just configured, you can see the devices that are registered to receive the Push Notification. Since, we just configured the service, we have none. You need to make your app (in this case an iOS app) to register the user iPhone/iPad with the SNS Service. You do that by passing the device push token that Apple will provide to your app. If you already have that token and just want to test the SNS Service, you can add it manually by clicking on "Add Endpoints" (Endpoint in our environment here is a user device). The EndpoinArn info that you also see in the console is like the "AWS SNS token" for that device. After you add a iOS device token, the SNS you create a EndpointArn.

To send a Push notification to that device, just select it and go on "Endpoint Actions -> Publish". Just type the message and click on "Publish Message". If you set everything right, you should receive a Push notification on that device.

Of course, sending Push Messages manually for you game/app is not very fun. So, you need to have a server and configured it to communicate with the AWS SNS and send the messages for you.  AWS has SDKs for several languages (.NET, PHP,...), so you can get the SDK go thru their documentation to configure your server.
Picture
That is it. Hope that this tutorial helps you and if you want to know more about that or other mobile topic, just let me know.
32 Comments

    Author

    This blog it not updated anymore.  

    Archives

    February 2015
    June 2014
    May 2014
    April 2014
    March 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    October 2012
    September 2012
    August 2012
    July 2012

    Categories

    All
    Data
    Event
    Fun
    Games
    Key Success Factors
    Management
    Marketing
    Mobile
    Monetization
    Movies
    Startup
    Statistics
    Technical
    Tutorial
    Videos

Powered by Create your own unique website with customizable templates.