Wednesday 6 August 2014

HB Blog 10: Android wearables basic PageNotification integration.

Wearables are the next big frontier for smart technology.Android Wear is an Android-based initiative, using Google's mobile operating system and a dedicated software development kit to kick-start the wearables space.

Step I :- Set up an Android Wear Virtual Device
   
To set up an Android Wear virtual device(Emulator) on IDE(Eclipse):

    1)Click Tools > Android > AVD Manager.
    2)Click Create....
    3)Fill in the following details for the AVD you want to specify and leave the rest of the fields with their default values:
        AVD Name - A name for your AVD
        Device - Android Wear Round or Square device types
        Target - Android 4.4W - API Level 20
        CPU/ABI - Android Wear ARM (armeabi-v7a)
        Keyboard - Select Hardware keyboard present
        Skin - AndroidWearRound or AndroidWearSquare depending on the selected device type
        Snapshot - Not selected
        Use Host GPU - Selected, to support custom activities for wearable notifications
    4)Click OK.
    5)Start the emulator:
        Select the virtual device you just created.
        Click Start..., then click Launch.
        Wait until the emulator initializes and shows the Android Wear home screen.

Step II :- Create android project and start coding...
//Few code snippets...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 int notificationId = 001;
        // Build intent for notification content
                Intent viewIntent = new Intent(this, MainActivity.class);
                PendingIntent viewPendingIntent =
                        PendingIntent.getActivity(this, 0, viewIntent, 0);
        
 // Create builder for the main notification
        Builder notificationBuilder =
                new Builder(this)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentTitle("Page 1")
                .setContentText("Harshal Benake demo message")
                .setContentIntent(viewPendingIntent);

        // Create a big text style for the second page
        BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
        secondPageStyle.setBigContentTitle("Page 2")
                       .bigText("Harshal Benake demo message BigTextStyle");

        // Create second page notification
        Notification secondPageNotification =
                new NotificationCompat.Builder(this)
                .setStyle(secondPageStyle)
                .build();

        // Add second page with wearable extender and extend the main notification
        Notification twoPageNotification =
                new WearableExtender()
                        .addPage(secondPageNotification)
                        .extend(notificationBuilder)
                        .build();

        // Issue the notification
        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.notify(notificationId, twoPageNotification);


 Refer the below link for complete sample code:-
 Download Sample Code
 Download Apk File

Tuesday 5 August 2014

HB Blog 9: Interesting websites you must see once.

1) Easycalculation
Click here : http://easycalculation.com/
Description : This free online math web site will help you learn mathematics in a easier way. EasyCalculation will also help you to solve difficult problems too.
2) It Ebooks
Click here : http://it-ebooks.info/
Description :This site helps to download IT ebooks for free, related to various programming languages and more.

3) Manymo: A Better Android Emulator
Click here : https://www.manymo.com/
Description :This is an online android emulator site.Android emulators for embedding apps in websites, development, collaboration, automated testing and QA in various screen sizes.

4)India Bix
Click here :  http://www.indiabix.com/
Description :IndiaBIX provides you lots of fully solved Aptitude questions and answers with explanation. 
 
5) Zamsar
Click here : http://www.zamzar.com/
Description : Zamzar is and online file converter.It supports over 1200 different conversions - Video Converter, Audio Converter, Music Converter, eBook Converter, Image Converter, CAD Converter - THE multipurpose converter.

Saturday 2 August 2014

HB Blog 8: Google develop custom Android edition for Project Ara.

Google is working with open-source development organization to develop a special edition of Android for the Project Ara customizable smartphone.
The $50 configurable smartphone will come with an empty phone frame and screen, and users can snap on or take out modular parts from the rear of the handset to add or remove features.
The smartphone, which will ship early next year, has already sparked the development of Lego-like modules that can be attached. Google has talked about detachable antenna and camera modules, but developers are also considering modules for wireless networking, gaming, storage and thermometers.







The Ara prototype. Photo: Norman Chan/Tested.com
The Ara prototype. Photo: Norman Chan/Tested.com

 Android can already plug and play SD cards. But additional OS functionality is needed for storage, cameras and other modules that are typically inside smartphones, but can now be externally added to Project Ara.
A lot of work is also being done on UniPro transport drivers, which connect modules and components in Project Ara. UniPro protocol drivers in Android will function much like the USB protocol, where modules will be recognized based on different driver “classes,” such as those for networking, sensor, imaging, input and others.
Some attachable parts may not be recognized by Android. For those parts, separate drivers need to be developed by module makers through emulators.

Google already offers a module developers kit (MDK) for Project Ara platform through which developers can take advantage of the UniPro hardware and protocol stack.


Image: Courtesy of Google
Image: Courtesy of Google

Project Ara is Google’s attempt to reinvent the cellphone as we know it. Instead of a slab of glass and metal that you have no ability to upgrade, save for buying a new device, it’s an attempt to launch a phone where all of the main components are interchangeable via modules that click in and out, attaching via electro-permanent magnets. Despite being highly customizable, it will only come in three main sizes, helping to eliminate the kind of device fragmentation that currently plagues Android. Google plans to roll out a “gray model,” a very basic device that costs as little as $50, as well as higher-end handsets that could go for as much as $500 and up. The former will be released first — around this time next year if all goes according to plan — and will likely be a smaller, Wi-Fi-only version. This bare-bones model will be followed by the higher-end ones eventually. But Google’s initial objective is to ramp up a hardware ecosystem that moves at the same pace as the software it runs.


Image: Courtesy of Google
Image: Courtesy of Google

HB Blog 7: Digital signature in android.

Below code snippet shows how to get signature from user gesture and save the image file in sd-card.




Refer the below link for complete sample code:-
Download Sample Code
Download Apk File

Xml file:- 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  <android.gesture.GestureOverlayView
        android:id="@+id/signaturePad"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:background="@android:color/white"
        android:clickable="false"
        android:eventsInterceptionEnabled="true"
        android:fadeEnabled="false"
        android:gestureColor="#0000ff"
        android:gestureStrokeLengthThreshold="0.1"
        android:gestureStrokeType="multiple"
        android:longClickable="false"
        android:orientation="vertical"
        android:uncertainGestureColor="#000000"
        android:splitMotionEvents="true" 
        android:fadeOffset="10000000">
    </android.gesture.GestureOverlayView>

 Java file:- 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  path=Environment.getExternalStorageDirectory()+"/signature.png";
        file = new File(path);
        file.delete();
        gestureView = (GestureOverlayView) findViewById(R.id.signaturePad);
        gestureView.setDrawingCacheEnabled(true);
        gestureView.setAlwaysDrawnWithCacheEnabled(true);
        gestureView.setHapticFeedbackEnabled(false);
        gestureView.cancelLongPress();
        gestureView.cancelClearAnimation();
        gestureView.addOnGestureListener(new OnGestureListener() {

            @Override
            public void onGestureStarted(GestureOverlayView arg0,
                    MotionEvent arg1) {
                if (arg1.getAction()==MotionEvent.ACTION_MOVE){
                    gestureTouch=false;                     
             }
             else {
                    gestureTouch=true;
            }
            }});

        donebutton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    bitmap = Bitmap.createBitmap(gestureView.getDrawingCache());
                    file.createNewFile();
                    FileOutputStream fos = new FileOutputStream(file);
                    fos = new FileOutputStream(file);
                    // compress to specified format (PNG), quality - which is
                    // ignored for PNG, and out stream
                    bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
                    fos.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            if(gestureTouch==false) {
                setResult(0);
                finish();
            }
            else{
                setResult(1);
                finish();
            }
            }
        });
 

Friday 1 August 2014

HB Blog 6: New Google Play Store API v2 For Developers.API That Gives Total Control Over APK Updates And Product Listings.

The Google Play Developer Console has undergone some pretty major changes over the years, including a complete overhaul 2 years ago. While the improvements continue to make for a more powerful and usable tool, some developers still find areas where it could be better. Google's engineers don't have time to build everything for everybody, but a new version of the Google Play Developer API makes it possible to build quite a few things for yourself. The new API allows developers to programmatically upload apks and modify almost every detail about your store listings.
2014-07-28_19h54_05
The new web API allows developers to build scripts or applications to automate deployment and update product listings quickly and without directly working with the Developer Console. Most of the new functionality is bundled into the Publishing API, a transaction-based system for managing Play Store listings and apks. It exposes the ability to change just about every field, image, and apk based on language. Further, apks and expansion files can be uploaded to select tracks (i.e. alpha, beta, production, rollout). It's even possible to make modifications to testing groups as needed. It's also possible to change pricing for in-app products, but it is done outside of the transactional model.
The Publishing API will probably become a staple in the distribution systems of larger publishers. Companies will be able to build custom software to enforce their own policies and limit the changes employees can make based on their roles. For example, a marketing manager might be limited to modifying descriptions and featured images, but cannot affect pricing, screenshots, or apk updates. This will also allow publishers to rapidly launch promotions and major updates across several countries and different apps instantly.
Version 1.1 of the API was dedicated to accessing the status of an individual in-app purchase or subscription, and cancelling subscriptions. These functions were available so external servers could fulfill in-app transactions (e.g. giving a paid item to a customer after their purchase is complete) and occasionally for customer service. While the original versions of these methods should remain functional for a long time, new names have been given to these methods, which should probably be used in all future development.
Google hasn't made an announcement regarding these changes (a brief note in the developer console mentions it, thanks Matthieu HarlĂ©), but its cached pages show that the documentation was updated sometime after July 4th. If you're interested in automating some of your Play Store distribution, or even building an app or web service for other developers to use, check out the developer docs for more details.