New logo!

Hi everybody,

As you can see in the header of the website. We are proud to present you our new logo, made by Loes Habraken. She is a good friend of PullesSon – Android and a wonderful freelance designer.

We are really happy with this contribution of Loes Habraken and in the future you might see more designs from her hand. If you are searching for design, logo of style you can always contact her. You can get more info about her at www.loeshabraken.com.

Thanks again Loes.

Kind regards,
PullesSon – Android

Tips & Tricks: WiFi Direct

Hi Android dev’s,

We are back in business at least on the website. We still are having some technical problems with our hardware.

Today we would like to share some information on WiFi Direct with Android.

What is WiFi Direct?
WiFi Direct is a direct connection between two WiFi devices, which at least one is WiFi Direct certified, without any access point in between. It can do peer to peer connections over WiFi, because it will start up an soft AP (Software Access Point). When the connection is established it can do similar things as bluetooth: share files, print files and play together. It has a larger range then bluetooth.

How to implement it in Android?
From Android 4.0 (API Level 14) it is possible to use WiFi Direct in applications.
Everything we need to do from within the application is coming from: WifiP2pManager. With WifiP2pManager you can do initialization, discover, connect and more.

To start you first need to add the following permissions to your Android manifest.

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

After the right permissions are added you need to add a simple broadcast receiver, so your application will receive the events from the Android system.

/**
 * A BroadcastReceiver that notifies of important Wi-Fi p2p events.
 */
public class WiFiDirectBroadcastReceiver extends BroadcastReceiver {
 
    private WifiP2pManager manager;
    private Channel channel;
    private MyWiFiActivity activity;
 
    public WiFiDirectBroadcastReceiver(WifiP2pManager manager, Channel channel,
            MyWifiActivity activity) {
        super();
        this.manager = manager;
        this.channel = channel;
        this.activity = activity;
    }
 
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
 
        if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
            int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
            if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
                // Wifi Direct is enabled
            } else {
                // Wi-Fi Direct is not enabled
            }
        } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
            // request available peers from the wifi p2p manager. This is an
            // asynchronous call and the calling activity is notified with a
            // callback on PeerListListener.onPeersAvailable()
            if (manager != null) {
                manager.requestPeers(channel, myPeerListListener);
            }
        } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
            // Respond to new connection or disconnections
        } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
            // Respond to this device's wifi state changing
        }
    }
}

Then in your activity add the following:

WifiP2pManager mManager;
Channel mChannel;
BroadcastReceiver mReceiver;
...
@Override
protected void onCreate(Bundle savedInstanceState){
    ...
    mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
    mChannel = mManager.initialize(this, getMainLooper(), null);
    Receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
 
    mIntentFilter = new IntentFilter();
    mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
    mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
    mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
    mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
    ...
}

Don’t forget to register and unregister the receiver in onResume() and onPause().

This is the first part you have to do, after this you can use the WifiP2pManager to discover peers and to connect to them.
This is done with the following code to discover peers:

manager.discoverPeers(channel, new WifiP2pManager.ActionListener() {
    @Override
    public void onSuccess() {
        ...
    }
 
    @Override
    public void onFailure(int reasonCode) {
        ...
    }
});

And for connecting to peers with the following code:

//obtain a peer from the WifiP2pDeviceList
WifiP2pDevice device;
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = device.deviceAddress;
manager.connect(channel, config, new ActionListener() {
 
    @Override
    public void onSuccess() {
        //success logic
    }
 
    @Override
    public void onFailure(int reason) {
        //failure logic
    }
});

We hope these tips and tricks will help you to start with WiFi Direct on Android.

Kind regards,
PullesSon – Android

Rough start and new projects.

Hi PullesSon followers,

We had a rough start of 2012 some problems with our computers and servers. Besides we got several requests for new project and we were really busy.

That’s why we didn’t update the website a lot and no tips and tricks were added.

Hopefully we will have some more time in February to continue updating the website and announcing new apps.

Regards,
PullesSon – Android.

Tips & Tricks: TeamBox

Hi Android-devs,

We hope you started the year good.

This week another tips and tricks from PullesSon, but again not an Android specific one.

Like all start-ups we also started searching for solutions to collaborate and project planning. Of course as start-up time is money and there is not much money available. So we started looking for several open-source and easy to setup project management tools.
We used several like dotProject, ProjectOpen, OpenProj and many others. But all had a lot of options and configurations that made it hard to let them work on a self-hosted server. Then we came by TeamBox.

This collaboration and project management tool is easy to setup and has a small and simple wizard to add your first organization, project and tasks. Adding projects, add people to projects and add tasks is really intuitive and easy. The collaboration part has a nice layout and easy to use and understand.
The calendar part is very useful to have an over view the project planning and easy syncable to Google Calendar.
The files part per project is a cool feature and file can be used in the collaboration conversations also, these file can also link directly to a dropbox.

A simple layout overview:
Tasks

If you don’t have a server, you can always use one of their plans specially the free plan with maximum 3 projects and 50MB storage.

TeamBox is a must for start-ups and even 1 person companies to quick and easy manage the projects, tasks and planning.

The only things we miss are:
1. Add an estimation when planning a task.
2. An Android app (If TeamBox reads this, feel free to contact us).

For more information look at their website TeamBox.com and the user guide.

Kind regards,
PullesSon – Android

Tips & Tricks: Happy new year!

Hi developers,

This week again no real tips and tricks from PullesSon – Android.

All we want to do with this post is wish you a happy new year and we hope you will begin the year close to your friends and family. We wish you all health, love and a lot of Android in 2012.

See you next year!

Kind regards,
PullesSon – Android.

Tips & Tricks: Merry Christmas

Hi developers,

Today no real tips and tricks from us. All we want to do is to wish you all a merry Christmas, because we don’t want you to miss gathering with family and friends while you are reading our tips and tricks or developing.

Android Snowman

Happy holidays!

Kind regards,
PullesSon – Android

Tips & Tricks: Screen sizes

Hi Android developers,

Last week was hectic, we needed to reinstall and reconfigure the backend server of Perka’s File stash.

This week we will take a little twist and we will talk about a topic that is more focused on design: Screen sizes.

When designing Android apps the best practice is to use Density-independent pixel (dp) as measure. A dp is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a “medium” density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160).

Another best practice is to use wrap_content and fill_parent in XML so the layout will scale automagically. Also a RelativeLayout is a good practice, it will keep the distances the same even if the screen is bigger or smaller.

Also keep in mind of using layout and orientation qualifiers, which can be added to the /res/ directory. This will make it easy to make to make a different layout for another screen size and/or orientation.

For images used in for the different screens, you might want to use draw9patch to make image.9.png files. These files are processed by the tool and you can assign how it will be stretched.

Another good practice is to use Fragments, this will allow you to reuse designs in different layouts. You can combine the fragments in a layout or just use 1 fragment as layout.

Extended information can be found at: Supporting Multiple Screen Sizes and Android Training Multiscreen

Kind regards,
PullesSon – Android

Tips & Tricks: BugSense

Hi developers,

Last week there was no tips and tricks from PullesSon – Android, because of the workload.

This time it will be not really about code, but about bugs.

For those who found the errors overview in the Android market console useful, but almost never get errors reported, there is BugSense.

BugSense will catch all the exceptions and send it right away to your BugSense dashboard and if you have it activated, also it will send you notification to your email.

Signing up is easy and it will direct you to add an application. Be sure to remember your API Key, even it’s also in your dashboard available.
After this there has to be made some code change in your application. First you have to download and add the library file to your project, then you need to add the internet permission by adding to the android manifest file. Then in the onCreate() method you have to add: BugSenseHandler.setup(this, YOUR_API_KEY);, where YOUR_API_KEY is your API Key from your dashboard (or the one previously remembered). Also don’t forget to include import com.bugsense.trace.BugSenseHandler; else you will get compile errors.

The dashboard is really intuitive and easy to understand. A quick overview of the errors reported is shown on the first page of your dashboard with exception name, file name, line number, OS version and application version. From here you can click on the error and it will show details.

The details page will show you all that’s included in the quick overview plus the amount of occurrences, a short stacktrace, last error instance time, ip, country, phone model, screen information and communication information.

In the configuration of the app registered in the dashboard you can add project viewers, like developers that want to know the error information. Also there is an option to set the application stage between testing and production.

Besides they have twitter and a chat to talk for support.

We also got an email from BugSense, mentioning if we needed help to implement the code, because there were no errors reported.
Seems we configured all well and we did some good coding, because there were just no errors generated. After provoking an exception we received it in the dashboard.

Good service and support on the BugSense’ side and easy to implement and understand. Keep up the good work.

Regards,
PullesSon – Android