• Home
  • About me
  • Curriculum
  • Projects
Facebook Linkedin Twitter

MauroCerbai

Software Engineer

Oggi si è tenuto il Google I/O: la conferenza annuale in cui big G presenta i nuovi prodotti e le nuove funzionalità dei loro servizi.
Saltiamo i preamboli, quali sono questi tre annunci?

1.Smart Action Suggestion for Google Photo
L'app Photo vi proporrà delle azioni a secondo del contesto  della foto. Per esempio condividere la foto con la persona che compare nella foto insieme a voi, oppure colorare una vecchia foto in bianco e nero. Una di queste azioni l'abbiamo tutti fatta spesso ma ora è più facile: convertire una foto in un documento. Google riconoscerà che è un documento e creerà automaticamente per voi un documento pdf.




2.AR Indication in Google Maps
Per semplificarvi la vita come non mai, invece di cercare di capire il nome della strada dalle targhe sempre troppo distanti da voi, Google ha inserito la possibilità di visualizzare le indicazione per il vostro tragitto sovrapposte alle immagini provenienti dalla vostra camera. Il risultato è incredibilmente semplice ed efficace.



3.Automatic Appointment Assistant
Questa la prevedo difficile da spiegare. Praticamente quando voi chiederete al vostro Assistente Google di prenotarvi un appuntamento dal vostro parrucchiere di fiducia in un giorno preciso in una fascia di orario (es. mercoledi dalle 10 alle 12) i servizi di Google si attiveranno e faranno una chiamata al negozio e concorderanno l'appuntamento con la proprietaria. Facile no? Se non fosse che dietro non c'è un call center ma un assistente virtuale robotico (lo stesso del vostro google assistant) che parlerà in maniera naturale ma soprattutto dovrà capire le risposte dell'interlocutore con l'obiettivo di concordare una data ed ora che soddisfi sia le vostre necesssità che quelle del negoziante.
Quest'ultima funzionalità è incredibile, fa impressione scoprire i passi da gigante che hanno fatto il machine learning, il cloud natural processing ed il cloud to speech. Guardate il video su youtube: https://youtu.be/D5VN56jQMWM


Nelle foto vedete il tempo esatto per poterle rivedere da video live disponibile a questo indirizzo: https://www.youtube.com/watch?v=ogfYd705cRs
Share
Tweet
Pin
Share
No commenti



Ma tu lo conosci Kotlin? Vieni a scoprire il linguaggio ad oggetti progettato da JetBrains con due workshop esclusivi organizzati dal GDG Torino!Che tu voglia sviluppare su Android al meglio o scoprire le potenzialità di questo nuovo linguaggio in un contesto inedito, questo è l’evento per te!
Due talk con due speaker d'eccezione: Mercoledì 4 aprile alle 18:30, presso la sede di Leva Engineering in Via Vincenzo Gioberti 18, prenderanno la parola Roberto Orgiu, GDE esperto di sviluppo Android e Roberto Franchini, CTO di Arcade.
https://www.meetup.com/it-IT/GDG-Torino/events/248799142/?eventId=248799142

LIVE ACTION:
Roberto Orgiu:

  • extension function
  • inline
  • reified
  • destructuring declarations
  • dataclass
  • component
  • operator
  • apply, let, with, run

Roberto Franchini:
  • live coding session handling twitter stream & save on OrientDB


Share
Tweet
Pin
Share
No commenti
We both know that programming Android is mostly rewriting a number of times the same things.
Well here we are, save this page on the bookmarks and copy/paste when you need it.

FINDVIEWBYID

 mWeatherTextView = (TextView) findViewById(R.id.tv_weather_data);  

READ JSON DATA

 JSONObject weatherdata = new JSONObject (JSONstring);  
 JSONObject weather = weatherdata.getJSONObject("weather");  
 String condition = weather.getString("condition");  

BUILD URI AND CONVERT TO URL

 Uri builturi = Uri.parse(BASE_URL).buildUpon()  
     .appendQueryParameter(QUERY_PARAM, param)  
     .build();  
 URL url = null;  
 try {  
   url = new URL(builturi.toString());  
 } catch (MalformedURLException e) {  
   e.printStackTrace();  
 }  
 return url;  

EXECUTE ASYNCTASK

 new GithubQueryTask().execute(githubSearchUrl);  


ADD MENU IN TOP BAR

 @Override  
 public boolean onCreateOptionsMenu(Menu menu) {  
   MenuInflater inflater = getMenuInflater();  
   inflater.inflate(R.menu.forecast, menu);  
   return true;  
 } 

 @Override  
 public boolean onOptionsItemSelected(MenuItem item) {  
   if (item.getItemId() == R.id.action_refresh) {  
     mWeatherTextView.setText("");  
     loadWeatherData();  
     return true;  
   }  
   return super.onOptionsItemSelected(item);  
 }  

EXPLICIT INTENT

 Intent intent = new Intent(this, SettingsActivity.class);  
 startActivity(intent);  


INTENT FOR EXTERNAL MAP

 Intent intent = new Intent(Intent.ACTION_VIEW);  
 Uri uri = new Uri.Builder().scheme("geo").path("0,0").query("california").build();  
 intent.setData(uri);  
 if (intent.resolveActivity(getPackageManager()) != null) {  
   startActivity(intent);  
 }  

SHARE INTENT

 Intent shareIntent = ShareCompat.IntentBuilder.from(activity)  
  .setType("text/plain")  
  .setText(shareText)  
  .getIntent();  
 if (shareIntent.resolveActivity(getPackageManager()) != null) {  
  startActivity(shareIntent);  
 }  

ITEM IN THE ACTION BAR

 <item  
   android:id="@+id/action_share"  
   android:title="Share"  
   android:orderInCategory="1"  
   app:showAsAction="ifRoom"/>  

ASYNCTASKLOADER

(it handles lifecycle)
 @Override  
 public Loader<String[]> onCreateLoader(int id, Bundle args) {  
   return new AsyncTaskLoader<String[]>(this) {  
     String[] weatherData = null; //Cache data  
     @Override protected void onStartLoading() {}//Check cache data and show progress bar then forceLoad()  
     @Override public String[] loadInBackground() {}//Get data from prefences or bundle and do network request  
     @Override public void deliverResult(String[] data) {}//save data in cache  
   };  
 }  

USE PREFERENCEFRAGMENT

SHAREDPREFERENCES

 SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);  
 sharedPreferences.getBoolean("show_bass", true);  


LISTEN TO SWYPE ON RECYCLEVIEW

 new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {  
   @Override  
   public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {  
     return false;  
   }  
   @Override  
   public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {  
     long id = (long) viewHolder.itemView.getTag();  
     removeGuest(id);  
     mAdapter.swapCursor(getAllGuests());  
   }  
 }).attachToRecyclerView(waitlistRecyclerView);  


Here some interesting images too:



Share
Tweet
Pin
Share
No commenti
Every time I open Android Studio this come to mind is this

IMHO


Observer Pattern? MVC? MVP? MVVM? I don't know
Do Androids (Programmer) Dream of Code Order?

Take a look at this post I found useful. Bye
Share
Tweet
Pin
Share
No commenti

I just received this email.
Congratulations!
Dear Mauro,
We are excited to offer you a Google Developer Challenge Scholarship to the Android Developer track.We received applications from many talented and motivated candidates, and yours truly stood out.
I'm very happy to announce that I've been selected for this scholarship involving the famous Google product and the amazing learning platform Udacity. Thank you!
Share
Tweet
Pin
Share
No commenti

Firebase Analytics is a free app measurement solution that provides insight on app usage and user engagement

The new incredible thing Google pull from a hat. A incredible versatile library to analyze data and user engament. Would you like to try it out? Well listen here.

How to add firebase analytics to an android app

  • Create a project on the firebase console : https://console.firebase.google.com/
  • Enter your app's package name
  • Donwload the json file provided and insert into the "app" folder in your android project

  • Then add this inside dependencies on your root level build.gradle
  • classpath 'com.google.gms:google-services:3.0.0'

  • And this at the bottom of the app level build.gradle
  • apply plugin: 'com.google.gms.google-services'
  • Inside the same file but under "dependencies" you put this
compile 'com.google.firebase:firebase-core:9.2.1'

  • Declare a "FirebaseAnalytics" object on top of your MainActivity and the onCreate initialize it
  • mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Now you have your basic analytics data provided by the default event. You wanna add your own? Easy.

How to add your custom event

You create a bundle and insert all the information you need the event you want to control. Take a look at the FirebaseAnalytics.Param for suggested event.
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
That's it.
Share
Tweet
Pin
Share
No commenti

I attended Google I/O 2016 Extended in Milan.
Nice people, nice place (thanks Subito).


 But the news? mmmm I bet they could do better: they didn't show anything on the "conversational" Google Now nor the Google Home but they show up another crazy messaging app. The fourth I think. Hangouts will be kicked back in the line, again...
Come on Google, you can do better than this.


Thanks to Subito for their amazing stuff and hospitality.

Share
Tweet
Pin
Share
No commenti
Hey,
First of all take a deep look at part 1 available here.
Instead what's new on part 2? Well basically two things:

  • in part 1 we built an app to receive constant location update, so this time we will see how to get just on time only
  • we will see how activity recognition works

Part 1 - Getting the last known location

So, how to receive the last gps location once from the google api services?
Follow every instruction of the part 1 and then on the onConnected method write this:

@Override
public void onConnected(@Nullable Bundle bundle) {
    mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
    if (mLastLocation != null) {
        mLatitude.setText(String.valueOf(mLastLocation.getLatitude()));
        mLatitude.setText(String.valueOf(mLastLocation.getLongitude()));
    }
}

Part 2 - Activity Recognition

Add the permission in your app manifest file:
<uses-permission android:name="com.google.android.gms.permTission.ACTIVITY_RECOGNITION" />
Then to handle the activity recognition in background we are gonna use an IntentService:
public class DetectedActivitiesIntentService extends IntentService {
    protected static final String TAG = "detections_is";
    public static final String BROADCAST_ACTION = "com.maurocerbai.googleaudacitylocationpart2.BROADCASTACTION";
    public static final String ACTIVITY_EXTRA = "com.maurocerbai.googleaudacitylocationpart2.ACTIVITYEXTRA";
    public DetectedActivitiesIntentService() {
        super(TAG);
    }
    @Override    protected void onHandleIntent(Intent intent) {
        ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
        Intent localIntent = new Intent(BROADCAST_ACTION);
        ArrayList <DetectedActivity> detectedActivities = (ArrayList) result.getProbableActivities();
        localIntent.putExtra(ACTIVITY_EXTRA,detectedActivities);
        LocalBroadcastManager.getInstance(this).sendBroadcast(localIntent);
    }
}
Don't forget to declare this service in the manifest:
<service android:name=".DetectedActivitiesIntentService"    android:exported="false" />
In your main activity build your goolge api connection as seen in part 1 but instead of location use activityrecognition as shown here:
private void buildGoogleApiClient() {
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(ActivityRecognition.API)
            .build();
}
and add the possibility to listen to the broadcast you made before in a inner class:
class ActivityDetectionBroadcastReceiver extends BroadcastReceiver{
    @Override    public void onReceive(Context context, Intent intent) {
        ArrayList <DetectedActivity> detectedActivities = intent.getParcelableArrayListExtra(Constants.ACTIVITY_EXTRA);
        String res = "";
        for (DetectedActivity d:detectedActivities)
            res+=d.getType()+" "+d.getConfidence();
        text_label.setText(res);
    }
}
Then a this two method and link them to the button of the view:
public void requestActivityUpdateButtonHandler (View view){
    ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(mGoogleApiClient,1000,getActivityDetectionPendingIntent()).setResultCallback(this);
}
public void removeActivityUpdateButtonHandler (View view){
    ActivityRecognition.ActivityRecognitionApi.removeActivityUpdates(mGoogleApiClient,getActivityDetectionPendingIntent()).setResultCallback(this);
}
Don't forget to handle the activity lifecycle adding this two method:
@Override protected void onResume() {
    super.onResume();
    LocalBroadcastManager.getInstance(this).registerReceiver(mActivityDetectionBroadcastReceiver,new IntentFilter(Constants.BROADCAST_ACTION));
}
@Override protected void onPause() {
    LocalBroadcastManager.getInstance(this).unregisterReceiver(mActivityDetectionBroadcastReceiver);
    super.onPause();
}
DONE. Good luck testing it because the emulator is not very helpful in this case. Maybe using a GPX file you can simulate the movements using the latest version of the sdk tools.
You can find the code here : https://bitbucket.org/mcmaur/googleaudacitylocationpart2
Share
Tweet
Pin
Share
No commenti
"One of the unique features of mobile applications is location awareness. Mobile users take their devices with them everywhere, and adding location awareness to your app offers users a more contextual experience. The location APIs available in Google Play services facilitate adding location awareness to your app with automated location tracking, geofencing, and activity recognition."
How to do that? Never been so simple:

Create a Google Api Client that use the api you need

mGoogleApiClient = new GoogleApiClient.Builder(this)
      .addApi(LocationServices.API)
      .addConnectionCallbacks(this)
      .addOnConnectionFailedListener(this)
      .build();

Implements
  • GoogleApiClientConnectionCallbacks
  • GoogleApiClient.onConnectionFailedListener
  • LocationListener

Wait for a onConnected callback and ask for updates on location
mLocationRequest = LocationRequest.create()
      .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
      .setInterval(1000);
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,mLocationRequest,this);

Wait for an other callback OnLocationChanged
@Override
public void onLocationChanged(Location location) {
  Log.d(LOG_TAG,"location: "+location.toString());
}

!NB: rembember to set:
  1. the permission on the manifest file
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

     2.Add the play services library in the manifest like this
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
     3. Add the lib to build gradle
compile 'com.google.android.gms:play-services:8.4.0'

Do not forget to call the appropiate method in order to deal with the activity lifecycle:
  @Override
    protected void onStart() {
        super.onStart();
        mGoogleApiClient.connect();
    }

    @Override
    protected void onStop() {
        mGoogleApiClient.disconnect();
        super.onStop();
    }

My code is available here : https://bitbucket.org/mcmaur/googleaudacitylocationpart1


Happy coding!
Share
Tweet
Pin
Share
No commenti
Thanks to GDG Milano for this interesting talk about the ADSL recently release with M release the last Google I/O conference. Still some bugs to fix but it's kinda interesting because it's seem simple to use it.  The android development is still a mess but this is a big help.
Thanks Google.
Share
Tweet
Pin
Share
No commenti

The founder & developer of the famous kontalk app is looking for help for it's open source free time project that "escalated quickly".

Feel free to contact him at https://github.com/kontalk or http://kontalk.org/
Share
Tweet
Pin
Share
No commenti

Unturned Guide Express


It's a while that I'm working on it but it's going very good: 1500 download and an average of 30-40 donwload per day. It's a guide app for the one of the Steam's most-popular games in this period: Uturned (http://store.steampowered.com/app/304930 ). You will find all the information you want in your hand: Every item with a quick summary of the important info, all the recipes with a recap of the ingredient and a complete list of the achievements and how to complete them.
This app is totally Ad Free and Open Source: free to collaborate through Github (https://github.com/mcmaur/UnturnedGuideExpress) or Google+ Community (https://plus.google.com/communities/110546531288401629264).

Update

I'm trying to redesign the app for supporting different layout for tablet and it is going good: now in tablet the navigation drawer is always visible. But for unknow reason tapping on the action bar doesn't open anymore navigation drawer (in smartphone). I trying to resolve with the help of the community here at stackoverflow : http://goo.gl/TcW95D
Please help me.

*This app is in no way affiliated with Unturned, or its developers. This is a fan made app. All rights belong to their respected owners.*
Share
Tweet
Pin
Share
No commenti
Older Posts

About me


Smiley face
Computer Science Degree, technology enthusiast, programmer, interested in startup & innovation, curious, precise & organized.

Follow Me

  • Facebook
  • Linkedin
  • Twitter
  • Bitbucket
  • Github

recent posts

Categories

  • dev
  • development
  • software
  • learn
  • learning
  • machine
  • machine learning
  • study
  • android
  • google
  • job
  • scikit
  • sklearn
  • app
  • udacity
  • gdg
  • google play
  • html
  • code
  • electronics
  • linux
  • script
  • uda
  • webgl
  • database
  • gdgmilano
  • help
  • open source
  • programming
  • smartphone
  • torino
  • weekend
  • work
  • workshop
  • 3d
  • firebase
  • gps
  • greatmind
  • hardware
  • location
  • personal computer
  • start up
  • .bashrc
  • GB
  • PS3
  • Vallée des Merveilles
  • action
  • analytics
  • audio
  • avi
  • bayes
  • books
  • bug
  • cpu
  • dinolib
  • docker
  • fake
  • ffmpeg
  • force
  • francaise
  • france
  • francia
  • free
  • gear 360
  • gglass
  • git
  • gitconfig
  • glass
  • hdd
  • hike
  • hiring
  • jenkins
  • joke
  • kde
  • kmix
  • magnetism
  • material
  • materialdesign
  • merge-it
  • messaging
  • microservices
  • mint
  • naive bayes
  • navigation drawer
  • nemo
  • nikola
  • nikolatesla
  • pc
  • ram
  • reading
  • refuge
  • samsung
  • space
  • spain
  • ssd
  • steam
  • tesla
  • unturned
  • valle delle meraviglie
  • veromix
  • versioning
  • windows
  • wizard
  • wolley
  • wolleybuy
  • xvid

Blog Archive

  • ottobre (1)
  • settembre (1)
  • gennaio (1)
  • novembre (1)
  • maggio (1)
  • aprile (1)
  • marzo (3)
  • febbraio (3)
  • gennaio (1)
  • novembre (7)
  • ottobre (4)
  • settembre (3)
  • agosto (1)
  • luglio (1)
  • settembre (1)
  • agosto (1)
  • giugno (2)
  • aprile (2)
  • marzo (1)
  • febbraio (3)
  • gennaio (2)
  • novembre (1)
  • agosto (2)
  • luglio (2)
  • giugno (3)
  • marzo (1)
  • novembre (1)
  • ottobre (1)
  • agosto (1)
  • giugno (1)
  • maggio (2)
  • marzo (2)
  • febbraio (1)
Facebook Linkedin Twitter Bitbucket Github

Created with by ThemeXpose | Distributed By Gooyaabi Templates