List of usage examples for android.content Intent CATEGORY_DEFAULT
String CATEGORY_DEFAULT
To view the source code for android.content Intent CATEGORY_DEFAULT.
Click Source Link
From source file:com.nhn.android.archetype.base.AABaseApplicationOrg.java
public static void applicationAllKill() { final ActivityManager am = (ActivityManager) _internalInstance.getSystemService(Activity.ACTIVITY_SERVICE); // stop running service inside current process. List<RunningServiceInfo> serviceList = am.getRunningServices(100); for (RunningServiceInfo service : serviceList) { if (service.pid == android.os.Process.myPid()) { Intent stop = new Intent(); stop.setComponent(service.service); _internalInstance.stopService(stop); }/*from ww w . j a v a 2s. c om*/ } // move current task to background. Intent launchHome = new Intent(Intent.ACTION_MAIN); launchHome.addCategory(Intent.CATEGORY_DEFAULT); launchHome.addCategory(Intent.CATEGORY_HOME); _internalInstance.startActivity(launchHome); // post delay runnable(waiting for home application launching) new Handler().postDelayed(new Runnable() { public void run() { am.killBackgroundProcesses(_internalInstance.getPackageName()); } }, 2000); }
From source file:io.rapidpro.androidchannel.DashboardFragment.java
public void onAttach(android.app.Activity activity) { super.onAttach(activity); m_receiver = new DashboardReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(Intents.UPDATE_COUNTS); filter.addCategory(Intent.CATEGORY_DEFAULT); activity.registerReceiver(m_receiver, filter); RapidPro.broadcastUpdatedCounts(activity); }
From source file:bg.mentormate.academy.reservations.activities.BroadcastNotifier.java
/** * Uses LocalBroadcastManager to send an {@link String} containing a logcat message. * {@link android.content.Intent} has the action {@code BROADCAST_ACTION} and the category {@code DEFAULT}. * * @param logData a {@link String} to insert into the log. *///w w w. j a v a 2s .c o m public void notifyProgress(String logData) { Intent localIntent = new Intent(); // The Intent contains the custom broadcast action for this app localIntent.setAction(DBConstants.BROADCAST_ACTION); localIntent.putExtra(DBConstants.EXTENDED_DATA_STATUS, -1); // Puts log data into the Intent localIntent.putExtra(DBConstants.EXTENDED_STATUS_LOG, logData); localIntent.addCategory(Intent.CATEGORY_DEFAULT); // Broadcasts the Intent mBroadcaster.sendBroadcast(localIntent); }
From source file:sample.multithreading.NetworkDownloadService.java
public void notifyProgress(String paramString) { Intent localIntent = new Intent(); localIntent.setAction(BROADCAST_ACTION); localIntent.putExtra(EXTRA_STATUS, -1); localIntent.putExtra(EXTRA_LOG, paramString); localIntent.addCategory(Intent.CATEGORY_DEFAULT); mBroadcastManager.sendBroadcast(localIntent); }
From source file:com.example.petri.myapplication.GCMMessageListenerService.java
/** * Called when message is received./*from ww w . ja v a2 s . c om*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { String message = data.getString("message"); int from_id = Integer.parseInt(data.getString("from_id")); int to_id = Integer.parseInt(data.getString("to_id")); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message); DatabaseHelper helper = new DatabaseHelper(this); SQLiteDatabase db = helper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("message", message); values.put("from_id", from_id); values.put("to_id", to_id); // Insert the new row, returning the primary key value of the new row long newRowId; newRowId = db.insert("messages", "message_id", values); String strSQL = "UPDATE chats SET last_activity = CURRENT_TIMESTAMP WHERE user_id = " + from_id; db.execSQL(strSQL); // SQLiteDatabase dbr = helper.getReadableDatabase(); // Cursor cursor = dbr.query(false, "messages", new String[]{"message"}, null, null, null, null, null, null); // cursor.moveToLast(); // String this_message = cursor.getString( // cursor.getColumnIndexOrThrow("message") // ); // Log.d("mygcm", this_message); Intent broadcastIntent = new Intent(); broadcastIntent.setAction(ChatActivity.MessageResponseReceiver.ACTION_RESP); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra("from_id", from_id); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); // SQLiteDatabase mydatabase = // mydatabase.execSQL("CREATE TABLE IF NOT EXISTS messages(message_id INT auto_increment, message TEXT, primary key(message_id));"); // mydatabase.execSQL("INSERT INTO TutorialsPoint VALUES('null','" + message + "');"); /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ sendNotification(message, from_id); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.LinkObj.java
public void handleDirectMessage(Context context, Contact from, JSONObject obj) { String mimeType = obj.optString(MIME_TYPE); Uri uri = Uri.parse(obj.optString(URI)); if (fileAvailable(mimeType, uri)) { Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_DEFAULT); i.setType(mimeType);//from w ww.jav a2s .c o m i.setData(uri); i.putExtra(Intent.EXTRA_TEXT, uri); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); (new PresenceAwareNotify(context)).notify("New content from Musubi", "New Content from Musubi", mimeType + " " + uri, contentIntent); } else { Log.w(TAG, "Received file, failed to handle: " + uri); } }
From source file:org.wso2.app.catalog.services.AppCatalogService.java
/** * Executes device management operations on the device. * * @param code - Operation object.//from w w w .j av a 2s. c o m */ public void doTask(String code) { switch (code) { case Constants.Operation.GET_APP_DOWNLOAD_PROGRESS: String downloadingApp = Preference.getString(context, context.getResources().getString(R.string.current_downloading_app)); JSONObject result = new JSONObject(); ApplicationManager applicationManager = new ApplicationManager(context); if (applicationManager.isPackageInstalled(Constants.AGENT_PACKAGE_NAME)) { IntentFilter filter = new IntentFilter(Constants.AGENT_APP_ACTION_RESPONSE); filter.addCategory(Intent.CATEGORY_DEFAULT); AgentServiceResponseReceiver receiver = new AgentServiceResponseReceiver(); registerReceiver(receiver, filter); CommonUtils.callAgentApp(context, Constants.Operation.GET_APP_DOWNLOAD_PROGRESS, null, null); } else { try { result.put(INTENT_KEY_APP, downloadingApp); result.put(INTENT_KEY_PROGRESS, Preference.getString(context, context.getResources().getString(R.string.app_download_progress))); } catch (JSONException e) { Log.e(TAG, "Result object creation failed" + e); sendBroadcast(Constants.Status.INTERNAL_SERVER_ERROR, null); } sendBroadcast(Constants.Status.SUCCESSFUL, result.toString()); } break; default: Log.e(TAG, "Invalid operation code received"); break; } }
From source file:org.woutly.android.MainActivity.java
private void launchSettingsActivity() { Intent i = new Intent(); i.setAction(SettingsMainFragment.INTENT_NAME); i.addCategory(Intent.CATEGORY_DEFAULT); startActivity(i); }
From source file:io.rapidpro.androidchannel.MessageListFragment.java
public void onAttach(android.app.Activity activity) { super.onAttach(activity); m_receiver = new UpdateReceiver(); IntentFilter filter = new IntentFilter(); filter.addCategory(Intent.CATEGORY_DEFAULT); activity.registerReceiver(m_receiver, filter); getLoaderManager().initLoader(0, null, this); // listen to changes to our content provider Handler handler = new Handler(activity.getMainLooper()); m_observer = new MessageObserver(handler); ContentResolver cr = activity.getContentResolver(); cr.registerContentObserver(DBCommandContentProvider.CONTENT_URI, true, m_observer); }
From source file:de.tubs.ibr.dtn.daemon.NeighborListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { NeighborListAdapter nla = (NeighborListAdapter) getListAdapter(); Node n = (Node) nla.getItem(position); // call external apps to handle the endpoint final Intent intent = new Intent(de.tubs.ibr.dtn.Intent.ENDPOINT_INTERACT); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(de.tubs.ibr.dtn.Intent.EXTRA_ENDPOINT, n.endpoint.toString()); try {//w w w . ja v a 2 s .c om getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException ex) { // no activity found to handle the request Toast.makeText(getActivity(), getString(R.string.toast_no_application), Toast.LENGTH_SHORT).show(); } // call super-method super.onListItemClick(l, v, position, id); }