List of usage examples for android.content Intent getAction
public @Nullable String getAction()
From source file:com.pixmob.r2droid.DeviceRegistrationService.java
@Override protected void handleAction(Intent intent) throws ActionExecutionFailedException, InterruptedException { startForeground();//from w w w. j a v a 2 s .c o m final String action = intent.getAction(); if (ACTION_CONNECT.equals(action)) { try { connect(); } finally { stopForeground(false); } } else if (ACTION_DISCONNECT.equals(action)) { try { disconnect(); } finally { stopForeground(false); } } else if (ACTION_C2DM_REGISTERED.equals(action)) { try { onC2DMRegistered(); } finally { stopForeground(true); } } else if (ACTION_C2DM_UNREGISTERED.equals(action)) { try { onC2DMUnregistered(); } finally { stopForeground(true); } } else { Log.wtf(TAG, "Unsupported action: " + action); } }
From source file:com.nadmm.airports.library.LibraryService.java
private void getBook(Intent intent) { String category = intent.getStringExtra(CATEGORY); String book = intent.getStringExtra(BOOK_NAME); File categoryDir = getCategoryDir(category); File pdfFile = new File(categoryDir, book); if (!pdfFile.exists()) { fetch(category, pdfFile);//www . j a va2 s .c o m } sendResult(intent.getAction(), category, pdfFile); }
From source file:com.khoahuy.phototag.HomeActivity.java
@Override protected void onResume() { super.onResume(); try {//from w w w . j ava 2 s .com loadContent(); Intent callerIntent = getIntent(); if (callerIntent != null && Intent.EXTRA_UID.equals(callerIntent.getAction())) { Bundle packageFromCaller = callerIntent.getBundleExtra("MyPackage"); if (packageFromCaller != null) { nfcid = packageFromCaller.getString("nfcid"); // processNfcID(); setIntent(callerIntent); dispatchTakePictureIntent(ACTION_TAKE_PHOTO_B); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.otaupdater.OTAUpdaterActivity.java
private boolean handleNotifAction(Intent intent) { String action = intent.getAction(); if (ROM_NOTIF_ACTION.equals(action)) { RomInfo.FACTORY.clearUpdateNotif(this); bar.setSelectedNavigationItem(romTabIdx); if (intent.getBooleanExtra(EXTRA_FLAG_DOWNLOAD_DIALOG, false)) { DownloadBarFragment.showDownloadingDialog(this, cfg.getRomDownloadID(), this); } else {/*from w ww . ja v a2 s . c om*/ RomInfo info = RomInfo.FACTORY.fromIntent(intent); if (info == null) info = cfg.getStoredRomUpdate(); if (info != null) info.showUpdateDialog(this, this); } } else if (KERNEL_NOTIF_ACTION.equals(action)) { KernelInfo.FACTORY.clearUpdateNotif(this); bar.setSelectedNavigationItem(kernelTabIdx); if (intent.getBooleanExtra(EXTRA_FLAG_DOWNLOAD_DIALOG, false)) { DownloadBarFragment.showDownloadingDialog(this, cfg.getKernelDownloadID(), this); } else { KernelInfo info = KernelInfo.FACTORY.fromIntent(intent); if (info == null) info = cfg.getStoredKernelUpdate(); if (info != null) info.showUpdateDialog(this, this); } } else { return false; } return true; }
From source file:a14n.geolocationdemo.MainActivity.java
@Override protected void onNewIntent(Intent intent) { // Reload the Flutter Dart code when the activity receives an intent // from the "flutter refresh" command. // This feature should only be enabled during development. Use the // debuggable flag as an indicator that we are in development mode. if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (Intent.ACTION_RUN.equals(intent.getAction())) { flutterView.runFromBundle(intent.getDataString(), intent.getStringExtra("snapshot")); }/*ww w . j ava 2 s. com*/ } }
From source file:com.github.opengarageapp.activity.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); String action = data.getAction(); if (requestCode == AUTHENTICATION_INTENT) { if (resultCode == RESULT_OK) { getAuthAndDo(action);// w w w. ja v a 2 s .co m } else { enableButtons1(true); enableButtons2(true); } } }
From source file:com.polyvi.xface.extension.telephony.XTelephonyExt.java
private void genIncomingCallBroadcastReceiver() { if (null == mIncomingCallBroadcastReceiver) { mIncomingCallBroadcastReceiver = new BroadcastReceiver() { @Override/*ww w. jav a2 s .c o m*/ public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (ACTION_PHONE_STATE_CHANGED.equals(action)) { incomingCallResponse(intent); } } }; } }
From source file:ca.uwaterloo.magic.goodhikes.GPSLoggingService.java
private void sendCommandToLooperThread(Intent command) { if (internalLooperThread != null) { Message msg = internalLooperThread.mLooperThreadHandler.obtainMessage(); msg.obj = command;//from w ww . j ava2 s . c o m Log.d(LOG_TAG, "Thread: " + Thread.currentThread().getId() + "; Sending " + command.getAction() + " command to looper thread"); internalLooperThread.mLooperThreadHandler.sendMessage(msg); } }
From source file:com.bluelinelabs.logansquare.typeconverters.IntentConverter.java
@Override public void serialize(Intent intent, String fieldName, boolean writeFieldNameForObject, JsonGenerator jsonGenerator) throws IOException { android.util.Log.d("json2notification", "IntentConverter:serialize"); if (intent == null) { android.util.Log.d("json2notification", "intent: null"); return;//from w ww .j ava 2 s. c o m } SimpleIntent simpleIntent = new SimpleIntent(); simpleIntent.uri = intent.getData(); simpleIntent.action = intent.getAction(); if (writeFieldNameForObject) jsonGenerator.writeFieldName(fieldName); SimpleIntent$$JsonObjectMapper._serialize((SimpleIntent) simpleIntent, jsonGenerator, true); }
From source file:android_network.hetnet.vpn_service.Receiver.java
@Override public void onReceive(final Context context, Intent intent) { Log.i(TAG, "Received " + intent); Util.logExtras(intent);/*from w w w .j ava 2 s . c o m*/ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); if (Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) { // Application added if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { // Show notification if (true) { int uid = intent.getIntExtra(Intent.EXTRA_UID, -1); notifyNewApplication(uid, context); } } } else if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) { // Application removed Rule.clearCache(context); if (intent.getBooleanExtra(Intent.EXTRA_DATA_REMOVED, false)) { // Remove settings String packageName = intent.getData().getSchemeSpecificPart(); Log.i(TAG, "Deleting settings package=" + packageName); context.getSharedPreferences("wifi", Context.MODE_PRIVATE).edit().remove(packageName).apply(); context.getSharedPreferences("other", Context.MODE_PRIVATE).edit().remove(packageName).apply(); context.getSharedPreferences("apply", Context.MODE_PRIVATE).edit().remove(packageName).apply(); context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE).edit().remove(packageName) .apply(); context.getSharedPreferences("screen_other", Context.MODE_PRIVATE).edit().remove(packageName) .apply(); context.getSharedPreferences("roaming", Context.MODE_PRIVATE).edit().remove(packageName).apply(); context.getSharedPreferences("notify", Context.MODE_PRIVATE).edit().remove(packageName).apply(); int uid = intent.getIntExtra(Intent.EXTRA_UID, 0); if (uid > 0) { DatabaseHelper.getInstance(context).clearAccess(uid, false); NotificationManagerCompat.from(context).cancel(uid); // installed notification NotificationManagerCompat.from(context).cancel(uid + 10000); // access notification } } } else { // Upgrade settings upgrade(true, context); // Start service try { if (prefs.getBoolean("enabled", false)) ServiceSinkhole.start("receiver", context); else if (prefs.getBoolean("show_stats", false)) ServiceSinkhole.run("receiver", context); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } if (Util.isInteractive(context)) ServiceSinkhole.reloadStats("receiver", context); } }