Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Thursday, 22 August 2013

Here, there and everywhere: Google Keep reminds you at the right time

Notes are a good way to keep track of all you have to do, but most of us need a little nudge now and then. Google Keep can remind you of important tasks and errands at just the right time and place. For example, Keep works with Google Now to remind you of your grocery list when you walk into your favorite grocery store, and nudges you on Thursday night to take out the trash.

To get started, select the “Remind me” button from the bottom of any note and choose the type of reminder you want to add. You can add time-based reminders for a specific date and time, or a more general time of day, like tomorrow morning. Adding a location reminder is incredibly easy too—as soon as you start typing Google Keep suggests places nearby.


 
Of course, sometimes plans change. If you get a reminder you’re not ready to deal with, simply snooze it to a time or place that’s better for you.



 

It’s now even easier to get to all of your notes using the new navigation drawer, which includes a way to view all of your upcoming reminders in one place. And for people who want more separation between their home and work lives, the drawer also lets you easily switch between your accounts. 


And finally, we've made it easier to add your existing photos to a Google Keep note on Android. When you tap the camera icon you can choose between taking a new photo or adding one you already have from Gallery.

The new update is gradually rolling out in Google Play, and available now on the web at http://drive.google.com/keep and in the Chrome App.
Read More

Thursday, 31 January 2013

Kiểm tra kết nối mạng của Android

- Trong android có 2 kiểu kết nối mạng là wifi và 3g or 4g...
- Tôi sẽ viết 1 class để bắt sự kiện on/off mạng...( khi mạng thay đổi trạng thái thì sẽ tự bắt được. bla bla..)
- Bài viết được tham khảo từ http://stackoverflow.com/questions/7094606/android-stop-start-service-depending-on-wifi-state

- Tạo class như sau:

public class NetWatcher extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        //here, check that the network connection is available. If yes, start your service. If not, stop your service.
       ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
       NetworkInfo info = cm.getActiveNetworkInfo();
       if (info != null) {
           if (info.isConnected()) {
               //start service
               Intent intent = new Intent(this, MyService.class);
               startService(intent);
           }
           else {
               //stop service
               Intent intent = new Intent(this, MyService.class);
               stopService(intent);
           }
       }
    }
}
-Trong AndroidManifest bạn thêm mấy dòng sau vào 
 
<receiver android:name="com.example.android.NetWatcher">
     <intent-filter>
          <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
     </intent-filter>
</receiver>
// chú ý đổi tên package trong android:name phù hợp với project của bạn



Read More